Mini Kabibi Habibi

Current Path : C:/Users/Public/Documents/DXperience 13.1 Demos/Silverlight/Bin/ClientBin/
Upload File :
Current File : C:/Users/Public/Documents/DXperience 13.1 Demos/Silverlight/Bin/ClientBin/UriStreamHandler.ashx.cs

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Net;
using System.IO;

namespace DevExpress.MailClient.DataService.ClientBin {
    /// <summary>
    /// Summary description for UriStreamHandler
    /// </summary>
    public class UriStreamHandler : IHttpHandler {

        public void ProcessRequest(HttpContext context) {
            try {
                string fileLink = context.Request.QueryString["uristream"];
                string fileExt = fileLink.Substring(fileLink.LastIndexOf(".") + 1);
                context.Response.ContentType = "image/" + fileExt;
                context.Response.Clear();
                context.Response.BufferOutput = true;
                using(WebClient client = new WebClient()) {
                    byte[] file = client.DownloadData(fileLink);
                    context.Response.BinaryWrite(file);
                }
            } catch { }
        }

        public bool IsReusable {
            get { return false; }
        }
    }
}