Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Passing % char in the URL

Status
Not open for further replies.

vilrbn

Programmer
Oct 29, 2002
105
0
0
FR
Hello,

I send a DB2 query from a main Form to another one within the URL. In the second form the query is associated to a textbox.

Here is an example of one part of the query:

(Main form)

MyString = "WHERE (CDDSGETK NOT LIKE '%AF%' )"

Response.Redirect("Query.aspx?Q=" & MyString)

(Second Form)

Query = Request.QueryString("Q")

Query = "WHERE (CDDSGETK NOT LIKE '%' )"

A part of the query has disappeared !! and in the URL I can see that the string is correct:

WHERE%20(CDDSGETK%20NOT%20LIKE%20'%AF%'%20)%20

I think the problem come from the %, but can't understand how the application interprets the URL result.

Any idea ?
 
Looks like % is used with 2 following chars to define other single chars in the string i.e. %20 = a space - so what does %AF mean - nothing by the looks of it...

Short of any clever explanation I would quickly parse the sql before sending to other page replacing all %'s with another unused harmless character or character string. At receiving end - do the reverse and everything should be ok!

Cheers,

Gary
 
Hello Gary,

I followed your instructions and it worked perfectly !!
Many thanks for your help !
 
There are lots of characters which cause problems, and there are other issues as well, so just use

server.urlencode(string) for each parameter's value when you construct the query string in the sending page, not for the query string as a whole

and in the receiving page, when you do a

string = request.querystring("ParamName"), it automatically decodes this for you

but there is a server.urldecode method as well if you need to for some other reason.

Mark

Mark [openup]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top