How to get wether the opened page is secure or nonsecure in asp.net
-
Hello Everybody, I am unable to get that thw opened page is secure or nonsecure. Actually i want know that page url is starting with http or https regards Rahul rahul saini
-
Hello Everybody, I am unable to get that thw opened page is secure or nonsecure. Actually i want know that page url is starting with http or https regards Rahul rahul saini
Try parsing the Request.Url.OriginalString path
Mark, http://aspnetlibrary.com
-
u can use it.. url = Request.ServerVariables("HTTP_REFERER") in url u will get whole url from addressbar. now u can check it. whether it's starting from http or https
Thanks, Sun Rays
-
Hello Sun Rays Thanks for rplying me. the code you have written is not working Can you please explain me more clearly Thanks Rahul rahul saini
That method may not work as the referrer isn't always passed by the browser (the user can disable it if they want) and it wont exist if you type the address directly into the address bar. Check out my earlier reply on the Request.Url.OriginalString method.
Mark, http://aspnetlibrary.com
-
Hello Sun Rays Thanks for rplying me. the code you have written is not working Can you please explain me more clearly Thanks Rahul rahul saini
Rahul, u try this write this on your page load event. Dim str As String str = Request.Url.OriginalString in str it will give u whole path of addressbar. Dim http As Boolean If str.StartsWith("http:/") Then http = True ElseIf str.StartsWith("https:/") Then http = False End If
Thanks, Sun Rays
-
Rahul, u try this write this on your page load event. Dim str As String str = Request.Url.OriginalString in str it will give u whole path of addressbar. Dim http As Boolean If str.StartsWith("http:/") Then http = True ElseIf str.StartsWith("https:/") Then http = False End If
Thanks, Sun Rays