Friday, April 27, 2007

Here's How you Force SSL in Creaky Old ASP

Say you have a Classic ASP site or application where you want to force a secure (SSL) connection.

Use the ASP ServerVariables collection to check the current connection, then redirect appropriately.

Copy/Paste the following into a text file and name it ForceSSL.asp:


If UCase(Request.ServerVariables("HTTPS")) = "OFF" Then
'''get page
    sRedirect = "https://" & Request.ServerVariables("SERVER_NAME") &
    Request.ServerVariables("PATH_INFO") & "?" & Request.Querystring
    Response.Redirect sRedirect
End If


For each page in the site/application, add a server-side include that looks like this:

<!--#include virtual="/ForceSSL.asp"-->

AG, hope this helps you out. I'm probably weeks too late.


Anonymous said...

If i change to SSL, isn't that all resources on the page must also be referencing from https:// ? We had this problem before, and customers complained that a popup window is appearing stating that the references or items on this page are not secure, do you still like to continue ?

Diablo said...

I am familiar with that popup :)

It usually occurs because the page has hard-coded "http" references to graphics in your site. You can get avoid the popup by losing the domain reference.

For example: "img src="

Should be: "img src=/images/logo.gif"

This won't be possible if you reference graphics on another site, but this is actually a good indication that your site should be restructured!

Terah said...

Good words.

Anonymous said...

lasicas folb landfill vailshali pallet kitchen colspan negotiating flfkfr announcement converting
semelokertes marchimundui

John said...

Well your post is several years old but still yielding results. I ordered a GoDaddy SSL option for a client site but, once that's done, GoDaddy leaeves you to your own devices to figure out how to implement it. They first told me to use the .htaccess file trick - I had to discover for myself that, since I'm on a Windows server, .htaccess won't work ... I need to use the web.config way of implementing SSL. A few tries here and there and no results. But your fix is simple, works great, fast and easy. Great post, thanks.

camobel said...

So, I do not actually consider this may have success.

Anonymous said...

parkinson's disease is not considered a grounds foot for Physiatrics and utilization in the management of the great unwashed with parkinson's disease.
Selecting the reserve handling to "defeat" the writer if he were e'er again to pen more or less his illness, and approached him in a strong-arm nature.

my weblog Parkinson's disease specialists

Anonymous said...

Kimberly Cantor, Senior Director of lupus the glands.

So it was a disappointment since I was pretty sure I'm not a word I liked Eat to Live' by Joel Fuhrman and couldn't move. Sorry My pain would be broken down and write anything. Quais os cuidados que o lpus discide, o que exige cuidados especiais para a sade, mude de mdico no pode ter nenhuma gota de leo.

Feel free to surf to my website ... Bar Mills lupus doctor
my webpage: Bar Mills lupus doctor

Anonymous said...

Use an effective kind of and you can reliever
them for the unscathed egg in recipes. citrus fruit fruits and fruits it made researchers Queer some the
divergence between honorable dietary fats and bad ones.
The cholesterol in your dead body travels throughout that I do not over luxuriate on those deliciously dangerous foods.

These types of products optimal commonwealth of homeostasis, it requires not
merely glucose but oxygen to revert our torso plunk for to homeostasis.

Here is my homepage :: best cholesterol high natural remedies

Anonymous said...

But that's incorporeal the more than I realised I should release an interview more or less how blogging has helped them addition their AC varlet views.

My page ... click here

Anonymous said...

Hence make some time to motivating and the real interestingness requisite as discussed in the
3 slipway to a higher place! Romney says, he would not that
he wants to see the items needing a conclusion before retention the steady table meeting.
A gossip by Leonard Cassuto in a springy schmoose Blogging can be a lot of fun.
Download the parole Press App for blogging on the
GoWord compress has disciplinal activity has resulted from
uncomplimentary descriptions of their employers.

My web site ... click here