Hi
I am implementing SSL for login page, but its implemented all pages. Even I unchecked 'Require SSL' in SSL Settings.
* IIS Configuration process:-
1) Created Self-Signed Certificate.
2) Done binding process.
Now after binding process it will take https for all pages. Even I didn't check 'Require SSL' in SSL Settings. I want to apply ssl (https) only for the login page not all pages.
* Also tried this code:-
Added this code on PageLoad event in login page. But its not working.
if(!HttpContext.Current.Request.IsSecureConnection)
{
Response.Redirect(Request.Url.Replace("http://","https://"),true);
return;
}
Please tell me how to do that. Any help would be greatly appreciated.
Thanks.
How to Implement SSL only for the login page in ASP.Net?
3 Answers
Know the answer? Post it. Somebody with the same question will find it here.


Kunal VaishyaRank #990 · 2K reputationPosted Dec 4, 2014, 8:01 PM EST
Try this below code, My be it will help you.
var _Url = HttpContext.Current.Request.Url;
var secureUrlBuilder = new UriBuilder(_Url);
secureUrlBuilder.Scheme = Uri.UriSchemeHttp;
secureUrlBuilder.Port = 80;
HttpContext.Current.Response.Redirect(secureUrlBuilder.Uri.ToString(), true);
Regards,
Kunal
Datta KharadRank #2,135 · 668 reputationPosted Dec 5, 2014, 12:25 AM EST
Kunal VaishyaRank #990 · 2K reputationPosted Dec 5, 2014, 12:54 AM EST