ASP.NET: Force Page to Use secure connection HTTPS

Sometimes we want to provide secure channel over an insecure network. e.g. for payment transactions. In that case we need HTTPS connection

Assume that your page is as follows: http://www.mydomain.com/mypage.aspx

Just add following code inside Load Event Handler!

If Not Request.IsSecureConnection Then
   Response.Redirect("https://www.mydomain.com/mypage.aspx ")
End If

1 comment:

  1. your blog is realy good you vist our site Experts in Genex database consulting
    enexdbs Databases allow quick searching and retrieval of data. Marketing, business, government, etc. rely heavily on data these days. The database administration system ties together end-users, applications, and the database itself catches and analyzes data. The DBMS software additionally contains the core amenities equipped to administrate the database. It supports the gripping history of the completed functions. Database performs as a query optimizer. The database management system has many advantages, and many organizations adopt database technologies to protect, maintain, and optimize their operational support. Database consultants are hired to fix outdated databases, review firm intentions, and design resolutions that can help a growing business enterprise. GENEX is the best database provider and consultancy in India. They support world-class technology for database systems. Here we can see the specialty of Genex database consulting support. Database Security

    ReplyDelete