Tag Archives: SSL

Security SSL

ASP.NET application serve pages only over HTTPS?

To Serve all the pages over https add this to the Application_BeginRequest method in your Global.asax file.

 Sub Application_BeginRequest(ByVal sender As Object, ByVal e As EventArgs)
   If Request.IsSecureConnection = False Then
     Dim ub As New UriBuilder(Request.Url)
     ub.Scheme = Uri.UriSchemeHttps
     ub.Port = 443
     Response.Redirect(ub.Uri.ToString, True)
   End If
 End Sub