473,403 Members | 2,323 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,403 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 5728

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: 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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.