Latest Technology News

Friday, May 17, 2013

Redirect HTTP to HTTPS - Superb Solution with Gloabal.asax

You can achieve this using "Gloabal.asax"..try this code..
protected void Application_BeginRequest(Object sender, EventArgs e)
{
if ( !Request.IsSecureConnection)
{
string path = string.Format("https{0}", Request.Url.AbsoluteUri.Substring(4));
Response.Redirect(path);
}
}

More topics are available on my blog: http://www.blog.rajeshgoutam.com/

2 comments: