Force ASP.NET Page to Use secure HTTP (https) with SSL/TLS

Force ASP.NET to use HTTPS
In that case we need HTTPS connection which ensures reasonable protection e.g. for payment transactions.
Ok let’s see how this thing works.
Say that your page is as follows: http://www.domain.com/yourpage.aspx
Ok, just add this code inside Load Event Handler and voila! That’s it!
If Not Request.IsSecureConnection Then
Response.Redirect("https://www.domain.com/yourpage.aspx ")
End If
Categories: Security