Redirect page http to https

Posted by Saravanan05 under ASP.NET on 2/6/2012 | Points: 10 | Views : 1498 | Status : [Member] | Replies : 0
Hi to all

Below code i used redirect the URL http to https:

http://localhost:61775/WebForm1.aspx

to
https://localhost:61775/WebForm1.aspx

But,it is not working in Local machine.

if (!Request.IsLocal && !Request.IsSecureConnection)
{
var ub = new UriBuilder(Request.Url);
ub.Scheme = Uri.UriSchemeHttps;
ub.Port = -1; // use default port for scheme
Response.Redirect(ub.Uri.ToString(), true);
return;
}

Regards
Saravana




Responses

(No response found.)

Login to post response