using System;
using System.Web;
using System.Net;
using System.IO;
using System.Text.RegularExpressions;
public class Handler : IHttpHandler
{
public void ProcessRequest(HttpContext context)
{
const string ROOT = "http://www.SQLHub.com";
string url = context.Request.QueryString.ToString();
CookieContainer CC = new CookieContainer();
HttpWebRequest Req = (HttpWebRequest)WebRequest.Create(ROOT + HttpUtility.UrlDecode(url));
Req.CookieContainer = CC;
try
{
WebResponse webResponse = Req.GetResponse();
string sTxt = new System.IO.StreamReader(webResponse.GetResponseStream(),
System.Text.Encoding.UTF8).ReadToEnd();
webResponse.Close();
context.Response.ContentType = webResponse.ContentType;
context.Response.ContentEncoding = System.Text.Encoding.UTF8;
context.Response.Write(sTxt);
}
catch
{
context.Response.Redirect(url);
}
}
public bool IsReusable
{
get
{
return false;
}
}
}
<add verb="*" path="Default.aspx" type="Handler"/>
Have a question about something in this article? You can receive help directly from the article author. Sign up for a free trial to get started.
Comments (0)