Cannot get right value from nested query string

  • Thread starter Thread starter Leonardo Santos-Macias
  • Start date Start date
L

Leonardo Santos-Macias

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

to.aspx?par1=value1

instead of

to.aspx?par1=value1&par2=value2

Is there any other way to write

go.aspx?redirect=to.aspx?par1=value1&par2=value2

to avoid this problem?.

thanks

Leonardo
 
Hi Leonardo,

You need to url encode the redirect parameter value so it looks something
like:
go.aspx?redirect=to.aspx%3fpar1%3dvalue1%26par2%3dvalue2

You can url encode strings using shared methods in the HttpUtility class.
For example:

Dim urlEncoded =
HttpUtility.UrlEncode("to.aspx?par1=value1&par2=value2")

You can decode the url at the other end in a similar way. For example:

Dim urlDecoded = HttpUtility.UrlDecode(Request.Params("redirect"))

Hope this help,

Phil Harvey
 
I would do:

go.aspx?redirect=to.aspx||parms=par1=value1|par2=value2

then when you get the parms value you can replace the || with ? and then the
| with & and you have your redirect string.

Just a thought
Chris
 
Thanks Phil...

This has sense but I am not writing any server code, I would like to fix it
in the client page (javascript included) since I want to have a "progress"
gid displayed while I do a search

<script language="javascript">
document.location.href="<%=Request.QueryString("redirect")%>";
</script>
 
Thanks Chris...

This has sense but I am not writing any server code, I would like to fix it
in the client page (javascript included) since I want to have a "progress"
gid displayed while I do a search

<script language="javascript">
document.location.href="<%=Request.QueryString("redirect")%>";
</script>
 
Back
Top