Querystring

I have codes with plus signs in them e.g.
ABC/+123

StockCode = Server.UrlEncode(TRIM(UCase(request.querystring("StockCode"))))
Variable StockCode = ABC%2F+123

StockCode = TRIM(UCase(request.querystring("StockCode")))
Variable StockCode =ABC/ 123

Does anyone know how to get around this?
HKFueyAsked:
Who is Participating?
 
GaryConnect With a Mentor Commented:
Are you using Server.URLEncode when you place the data on the page initially - that is what will encode the querystring correctly.  Not on the receiving page e.g.

<a href="mypage.asp?stockcode=<%=server.urlencode(myvalue)%>">mylink</a>
0
 
GaryCommented:
Use Server.UrlEncode to pass it then when you get it out call Server.UrlDecode
0
 
Manuel Marienne-DuchêneConnect With a Mentor ITMCommented:
If I am not mistaken, there is not Server.UrlDecode in classic ASP

See :

http://gwobcke.blogspot.fr/2010/04/useful-classic-asp-tips-and-functions.html
0
Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

 
HKFueyAuthor Commented:
Hi Gary, can't get that to work. Here is some more of my code: -

Dim Warehouse, StockCode, QtyCounted
Warehouse = TRIM(request.querystring("Warehouse"))
StockCode = Server.UrlEncode(TRIM(UCase(request.querystring("StockCode"))))

SqlStr = "INSERT INTO StockTake (Warehouse, StockCode) "
SqlStr = SqlStr & "SELECT '" & Warehouse & "', '" & StockCode & "'"
Set Rst = dbConnect.Execute(SQLstr)
0
 
GaryCommented:
If it is classic then just use request.querystring should already decode it. (But it's been a long time since I used Classic ASP)
0
 
GaryCommented:
You don't need to encode the querystring when you request it, just use

StockCode = TRIM(UCase(request.querystring("StockCode")))

What should StockCode look like?
0
 
HKFueyAuthor Commented:
Hi manumd
I tried the UrlDecode function with same result.
The StockCode should be 'ABC/+123' the data appended to the table is this:
'ABC/ 123' (Plus sign replaced by a space)
0
 
Manuel Marienne-DuchêneITMCommented:
agree with Gacy it should work
0
 
HKFueyAuthor Commented:
Spot on Gary, Thanks for the help.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.