?
Solved

Querystring

Posted on 2012-09-10
9
Medium Priority
?
284 Views
Last Modified: 2012-09-10
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?
0
Comment
Question by:HKFuey
  • 4
  • 3
  • 2
9 Comments
 
LVL 58

Expert Comment

by:Gary
ID: 38382816
Use Server.UrlEncode to pass it then when you get it out call Server.UrlDecode
0
 
LVL 6

Assisted Solution

by:Manuel Marienne-Duchêne
Manuel Marienne-Duchêne earned 200 total points
ID: 38382866
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
 

Author Comment

by:HKFuey
ID: 38382892
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
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
LVL 58

Expert Comment

by:Gary
ID: 38382896
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
 
LVL 58

Expert Comment

by:Gary
ID: 38382903
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
 

Author Comment

by:HKFuey
ID: 38382916
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
 
LVL 58

Accepted Solution

by:
Gary earned 1800 total points
ID: 38382935
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
 
LVL 6

Expert Comment

by:Manuel Marienne-Duchêne
ID: 38382999
agree with Gacy it should work
0
 

Author Closing Comment

by:HKFuey
ID: 38383420
Spot on Gary, Thanks for the help.
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

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

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Hello, all! I just recently started using Microsoft's IIS 7.5 within Windows 7, as I just downloaded and installed the 90 day trial of Windows 7. (Got to love Microsoft for allowing 90 days) The main reason for downloading and testing Windows 7 is t…
I would like to start this tip/trick by saying Thank You, to all who said that this could not be done, as it forced me to make sure that it could be accomplished. :) To start, I want to make sure everyone understands the importance of utilizing p…
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
When cloud platforms entered the scene, users and companies jumped on board to take advantage of the many benefits, like the ability to work and connect with company information from various locations. What many didn't foresee was the increased risk…

864 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question