From http to https you need to make redirect.
The main reason the RewritePath is not working is because the http and https work on different ports. Also the Application Start is not the place to call this thinks. The BeginRequest is the one.
So if you like to change all the request automatically to https, use this code.
protected void Application_BeginRequest(Object sender, EventArgs e)
{
HttpApplication app = (HttpApplication)sender;
string cTheFile = HttpContext.Current.Request.Path;
string sExtentionOfThisFile = System.IO.Path.GetExtension(cTheFile);
if (sExtentionOfThisFile.Equals(".aspx", StringComparison.InvariantCultureIgnoreCase))
{
if (!app.Context.Request.IsSecureConnection)
{
Response.Redirect(app.Context.Request.RawUrl.Replace("http://", "https://"), true);
return;
}
}
// rest of your code here and below
}
You can also use this module to make this switching automatically.