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);
}}
yada rewrite modulü ile :
<rule name="HTTP to HTTPS redirect" stopProcessing="true"> <match url="(.*)" /> <conditions> <add input="{HTTPS}" pattern="off" ignoreCase="true" /> </conditions> <action type="Redirect" redirectType="Found" url="https://{HTTP_HOST}/{R:1}" /></rule>