detect https

  • Thread starter Thread starter SJ
  • Start date Start date
Hi,
How would I detect if a server is running securely (https) or not?

Try

If Request.Url.Scheme.Equals("https") Then
' Is secure...
End If

A better approach would be to restrict the access to the application by
IIS, which allows to force the use of SSL. In this case you won't have
to check programmatically.

--
Karsten Samaschke
IT-Consulting, IT-Development, IT-Training
5x MS MVP ASP / ASP.NET, Germany
Homepage: http://www.ksamaschke.de
- - - - - - - - - - - - - - - - - - - - - - - - - -
My Weblog: http://www.karsan.de
My Books: http://books.ksamaschke.de
 
Juan said:
Request.ServerVariables("HTTPS")

That's only half the truth. You need to check for the value "on" as
well. But this is really just an awkward way of saying

Request.IsSecureConnection

;-)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top