[thelist] URL Parameters with... parameters.
Gary McPherson
genyus at ingenyus.net
Tue Jul 8 10:32:14 CDT 2003
> Hey folks,
>
> I have a simple question that's been bugging me. I have a
> redirect page used for tracking exit pages. All links
> pointing to outside websites are sent to a page where the
> info is recorded and then they are redirected. Problem is
> when the outside links have more than one parameter.
>
> /redirect.asp?page=www.website.com?param1=value¶m2=value
>
> So, the page parameter is for my page. param1 and param2 are
> part of the URL I want to record and redirect. Problem is
> that my ASP page thinks that param2 is a parameter for my
> page, and not part of the URL. I suppose param1 is not
> treated as part of the URL because it is not preceeded by an
> ampersand.
>
> Any ideas on how to make param2 (and any more parameters that may
> follow) to be ignored?
What you should do is use the Server.URLEncode method to encode the URL,
then append that to your redirect.asp path like this:
"/redirect.asp?page=" &
Server.URLEncode("http://www.website.com?param1=value1¶m2=value2")
Which would result in a url looking something like this:
[path]/redirect.asp?page=http%3A%2F%2Fwww%2Ewebsite%2Ecom%3Fparam1%3Dval
ue1%26param2%3Dvalue2
Then your redirect page just calls the redirect like this:
Response.Redirect(Request.QueryString("page"))
And you're done.
HTH,
Gary
More information about the thelist
mailing list