Ask a Question related to ASP.NET Security, Design and Development.
-
Framework fan #1
Automatically toggle between https and http
Hi,
Is this possible:
Have a seperate folder that just contains the aspx webforms that you
require to run under SSL https. (Set IIS directory permissions up for
this folder to be used for SSL)
Then have a default webform page with a button on it with this code:
Response.Redirect("Special_SSL_Folder/SSLPage.aspx")
When you are redirected, the browser "automatically" uses httpS,
rather than http. (Based on the IIS directory permissions set up for
SSL on this folder.)
Then, on the SSL webform page, you have another button on it with this
code:
Response.Redirect("../Non_SSL_Folder/NormalPage.aspx") 'Go back to
http
When you are redirected, the browser "automatically" drops the secure
SSL https connection, and you are back to using http again. (Because
the webforms inside the Non_SSL_Folder doesn't have SSL https settings
set under IIS.)
Is this possible?
Many thanks for any information.
Best regards from Frameworker.
Framework fan Guest
-
How to automatically change from httpS to http for a specific folder??
There are great instructions on the web for force HTTPS for specific folder How to automatically change from http to https for a specific folde... -
Switching Between HTTP and HTTPS
Hi I wish to have a web site that has most of the pages as normal HTTP pages but has some areas that use HTTPS. I want to have it that if a user... -
http to https
Is there a coldfusion function that determines the gives me the protocol of the address bar(http, https) .I tried GetHttpRequestData, but I do not... -
PHP won't parse under https, but will with http
I'm not sure if this is the right forum for this question, but I'm hoping someone can help nonetheless. :) I installed an SSL Cert. on a site the... -
HTTPS to HTTP
When I am using server-side button to switch from https to http by using response.redirect "http://a.apsx" in response to the client event, I am... -
Sean Winstead #2
Re: Automatically toggle between https and http
Here's an excellent article (with complete source code) about
switching between http and https automatically. I have successfully
used it on a production web site.
[url]http://www.codeproject.com/aspnet/WebPageSecurity.asp[/url]
--
Sean Winstead
[url]http://www.componentscience.net[/url]
Sean Winstead Guest
-
Framework fan #3
Re: Automatically toggle between https and http
I have solved my problem.
For any aspx webform that you want to use for SSL, put this inside the
Page_Init function:
Response.Buffer = True
If (Request.ServerVariables("HTTPS") = "off") Then
Dim xredir__, xqstr__ As String
xredir__ = "https://" &
Request.ServerVariables("SERVER_NAME") & _
Response.ApplyAppPathModifier(Request.ServerVariab les("SCRIPT_NAME"))
xqstr__ = Request.ServerVariables("QUERY_STRING")
If xqstr__ <> "" Then xredir__ = xredir__ & "?" & xqstr__
Response.Redirect(xredir__)
End If
Then, for all your other aspx webforms that don't require SSL, put
this inside the Page_Init function:
Response.Buffer = True
If (Request.ServerVariables("HTTPS") = "on") Then
Dim xredir__, xqstr__ As String
xredir__ = "http://" &
Request.ServerVariables("SERVER_NAME") & _
Response.ApplyAppPathModifier(Request.ServerVariab les("SCRIPT_NAME"))
xqstr__ = Request.ServerVariables("QUERY_STRING")
If xqstr__ <> "" Then xredir__ = xredir__ & "?" & xqstr__
Response.Redirect(xredir__)
End If
Please notice the use of the ApplyAppPathModifier method. This is
used in order to preserve session state if you are using the
cookieless option.
Most of the code above was taken from the 4guysfromrolla site. I just
put the code inside the code behind section, rather than using <% %>
inside html. Also, I noticed the use of the ApplyAppPathModifier
method inside another thread in the .net newsgroups, and I needed it
because I use cookieless state.
-Frameworker.
[email]tempframeworkfan@hotmail.com[/email] (Framework fan) wrote in message news:<f109ac80.0404010247.59701d5c@posting.google. com>...> Hi,
>
> Is this possible:
>
> Have a seperate folder that just contains the aspx webforms that you
> require to run under SSL https. (Set IIS directory permissions up for
> this folder to be used for SSL)
>
> Then have a default webform page with a button on it with this code:
>
> Response.Redirect("Special_SSL_Folder/SSLPage.aspx")
>
> When you are redirected, the browser "automatically" uses httpS,
> rather than http. (Based on the IIS directory permissions set up for
> SSL on this folder.)
>
> Then, on the SSL webform page, you have another button on it with this
> code:
>
> Response.Redirect("../Non_SSL_Folder/NormalPage.aspx") 'Go back to
> http
>
> When you are redirected, the browser "automatically" drops the secure
> SSL https connection, and you are back to using http again. (Because
> the webforms inside the Non_SSL_Folder doesn't have SSL https settings
> set under IIS.)
>
> Is this possible?
>
> Many thanks for any information.
>
> Best regards from Frameworker.Framework fan Guest
-
Framework fan #4
Re: Automatically toggle between https and http
Thanks a lot for that article link Sean - very interesting.
Sean Winstead <sean_at_componentscience_dot_net> wrote in message news:<3edo60lhl5kg71p3ac6g6csdae417fduc0@4ax.com>. ..> Here's an excellent article (with complete source code) about
> switching between http and https automatically. I have successfully
> used it on a production web site.
>
> [url]http://www.codeproject.com/aspnet/WebPageSecurity.asp[/url]Framework fan Guest



Reply With Quote

