This is a mirror of official site: http://jasper-net.blogspot.com/

Checking whether page is secure or not in ASP.NET or JavaScript

| Friday, April 8, 2011
Recently in one the project we require to check whether page is secure or not as we are going to open a new popup window from that page and that why we need to pass https protocol if we have that page secure. I have search lots of things on internet and I have found following ways of finding whether page is secure or not in ASP.NET or JavaScript.

In ASP.NET There are two way of doing it. Either we can use current request to check whether it is secured or not or we can use server variables to check whether it it secure or not just like following.

HttpContext.Current.Request.IsSecureConnection

Here in above code If this returns true then Page is secured otherwise it is not Or you can use following server variable to check the protocol.

Request.ServerVariables["SERVER_PROTOCOL"];

Read more: DotNetJalps

Posted via email from Jasper-net

0 comments: