473,327 Members | 1,936 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,327 software developers and data experts.

Switch page to SSL Programatically?

Howdy,

I'm trying to have select pages always be secure and others I don't care.
I'm using

If Request.ServerVariables("SERVER_PORT") = 80 Then

Dim strSecureURL

strSecureURL = "https://"

strSecureURL = strSecureURL & Request.ServerVariables("SERVER_NAME")

strSecureURL = strSecureURL & Request.ServerVariables("URL")

Response.Redirect(strSecureURL)

End If

This works, but is there a better way for .net 2.0?

Thanks,

Merry Christmas

David Lozzi
Dec 8 '06 #1
2 1446
Instead of testing for the server port variable, test for the HTTPS
variable. It will return ON if it's a secure connection or OFF it is isn't.
This would avoid any issues where the server or ssl certificate is running
on a port other than 80.
--

Hope this helps,
Mark Fitzpatrick
Former Microsoft FrontPage MVP 199?-2006

"David Lozzi" <dl****@nospam.nospamwrote in message
news:%2****************@TK2MSFTNGP04.phx.gbl...
Howdy,

I'm trying to have select pages always be secure and others I don't care.
I'm using

If Request.ServerVariables("SERVER_PORT") = 80 Then

Dim strSecureURL

strSecureURL = "https://"

strSecureURL = strSecureURL & Request.ServerVariables("SERVER_NAME")

strSecureURL = strSecureURL & Request.ServerVariables("URL")

Response.Redirect(strSecureURL)

End If

This works, but is there a better way for .net 2.0?

Thanks,

Merry Christmas

David Lozzi


Dec 9 '06 #2
"David Lozzi" <dl****@nospam.nospamwrote in message
news:%2****************@TK2MSFTNGP04.phx.gbl...
This works, but is there a better way for .net 2.0?
http://www.codeproject.com/aspnet/We...select=1697847
Dec 10 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Dave Bootsma | last post by:
Is it possible to programatically save a certain image from a certain web page? I want to automatically get a specific graphic from a specific web page programatically so I can automate the...
2
by: cherbina Vladimir | last post by:
hello, how can I programatically switch on/off the browsing images and playing sounds in IE ? I need to change the check boxes which are at "Tools->Internet options...->Advanced->Show pictures" ...
1
by: Tom Jones | last post by:
Hi, I am using the HttpWebRequest and HttpWebResponse classes to pull information from a web server on the internet. I have an account on one of the webservers that I need to log into...
7
by: Cliff Cavin | last post by:
How do I programatically change the background color of an aspx page in code? Is there something like Page.BgColor = "#FFFFFF" ? For that matter, how do I access any of the DOCUMENT...
1
by: Greg | last post by:
In my ASP.NET application I have a button that when pressed, data needs to be saved based on what the user typed in. I have other controls on the same page that should be updated as a result of the...
14
by: Paul | last post by:
I want to set the page title and/or a form hidden field programatically through ASP.Net. I do not want to use something like... <% sTitle ="My Title" %> <html><title><%=sTitle%></title>..... ...
1
by: thomasamillergoogle | last post by:
I have a site that sometimes gets extremely high server loads. I would like to make it so if the sustained server load is very high (million page views per hour) then it will switch to text only...
0
by: jason | last post by:
I googled a lot, couldn't find a good solution. Any help is greatly appreciated. What I want to do is: Given a web page in a running IE browser , i want to save an image in this web page to...
1
by: Robert Burdick [eMVP] | last post by:
Hello All: I cannot seem to get a simple programmatic post to work. From one ASPX page, I want to generate HTML from another page. Thus, I programatically post to the second page and read the...
1
by: ArunDhaJ | last post by:
Hi, I'm in need of help for solving the following problem: I've a page with two div tag as follows: <div id="divNormalView" runat="server"> <asp:listbox id="listSelectedMembers"...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.