473,394 Members | 1,748 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,394 software developers and data experts.

Using ASP to capture a query string and redirect to SSL

I am looking for some method to capture, into a variable, the entire URL of
an http request and redirect to SSL. For example, if a user opens a browser
and typed in

http://myserver.com/application/some...893bdgt0248991

I want to be able to redirect to an SSL connection

httpS://myserver.com/application/som...893bdgt0248991

Your help is appreciated.
Jul 20 '06 #1
3 5726

Nuevo wrote:
I am looking for some method to capture, into a variable, the entire URL of
an http request and redirect to SSL. For example, if a user opens a browser
and typed in

http://myserver.com/application/some...893bdgt0248991

I want to be able to redirect to an SSL connection

httpS://myserver.com/application/som...893bdgt0248991

Your help is appreciated.
<%
url = "https://myserver.com/application/some.asp?"
qrystr = ""
For Each x In Request.QueryString
qrystr = qrystr & "&" & x & "=" & Request.QueryString(x)
Next

strRedirect = url & right(qrystr,len(qrystr)-1)

Response.Redirect strRedirect
%>

--
Mike Brind

Jul 20 '06 #2

"Nuevo" <im*********@gmail.comwrote in message
news:OG**************@TK2MSFTNGP02.phx.gbl...
>I am looking for some method to capture, into a variable, the entire URL of
an http request and redirect to SSL. For example, if a user opens a browser
and typed in

http://myserver.com/application/some...893bdgt0248991

I want to be able to redirect to an SSL connection

httpS://myserver.com/application/som...893bdgt0248991

Your help is appreciated.
This expression should get everything but the protocol from the original
URL, including the server's host name, file name and any directory info that
may have been included:

Url = Request.ServerVariables("SERVER_NAME") & _
Request.ServerVariables("URL") & "?" & _
Request.ServerVariables("QUERY_STRING")

Response.Redirect "https://" & Url
-Mark


Jul 21 '06 #3
On Thu, 20 Jul 2006 15:28:29 -0500, Mike Brind <pa*******@hotmail.com>
wrote:
<%
url = "https://myserver.com/application/some.asp?"
qrystr = ""
For Each x In Request.QueryString
qrystr = qrystr & "&" & x & "=" & Request.QueryString(x)
Next

strRedirect = url & right(qrystr,len(qrystr)-1)

Response.Redirect strRedirect
%>
You can actually use the QueryString collection as a scalar rather than
iterating through it:

<% Option Explicit %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<title>Default</title>
<p><%= Server.HtmlEncode(Request.QueryString) %></p>

--
Justin Piper
Bizco Technologies
http://www.bizco.com/
Jul 21 '06 #4

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

Similar topics

3
by: Paul M. | last post by:
Hi, I am trying to populate 3 paramters in an asp .net (vb) page redirect, the first one is ok ok and gets populated by the other two get inserted into the url for the redirect as empty strings!...
2
by: Andy | last post by:
I haven't done any web work for over a year and for the life of me I cannot remember how to use a query string in a URL. I want the link to be page.aspx?ID=1 then pass 1 into a query like this ...
0
by: Michelle Keys | last post by:
I am trying to call a print function to print a string from a database using javascript. Which is RC_DATA of Varchar2(2500). This is a javascript is not being used. I have a thing that needs to...
4
by: Dave | last post by:
Hi, Is there anyway to mimic forms authentication's loginUrl and RedirectFromLoginPage functionality using Windows authentication? We are developing intranet sites using basic authentication...
4
by: George | last post by:
I am trying to check whether a query string is being passed to my .aspx page, like so: If Not Request.QueryString Is Nothing Then If CInt(Request.QueryString.GetValues("values")(0)) <> 1 Then...
11
by: Alexander Bosch | last post by:
Hi, I'm having a problem similar to the one that's stated in this KB http://support.microsoft.com/default.aspx?scid=kb;en-us;839521 When I'm posting a page to itself with the bool value as true it...
8
by: Dave | last post by:
Hello all, I have been able to use a Javascript alert box in my vb.net web application, for example: Dim msg As String = "Hello, world." Dim alertScript As String = "<script...
6
by: Leonardo Santos-Macias | last post by:
I would like to query a nested query string go.aspx?redirect=to.aspx?par1=value1&par2=value2 The problem is that inside go.aspx, Request.QueryString("redirect") only gives me ...
1
by: Jeck621 | last post by:
I like to create a custom code to make custom redirect. For example, I like this URL to be the redirect URL http://testme.now/test to be redirected to http://nowtesting.com. Actuall the /test folder...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.