Many times we need to implement SSL (Secure Socket Layer|) certificate on website for data security. After SSL implementation you don't want to allow page access through http://.
If any one try to access website using http:// then he/she should be redirected in https://. So we can achieve this implementing below rule in asp.net Web.config file.
We can also check visitors secure connection using Request.IsSecureConnection property.
protected void Page_Load(object sender, EventArgs e)
if (!Request.IsSecureConnection) // check is secure connection used or not
// redirect visitor to http to https