The Forum has been Updated
The code has been upgraded to the latest .NET core version. Please check instructions in the Community Announcements about migrating your account.
I've been googling this for days now, found plenty of people with the same problem but no solutions.
I'm working on a redirection file for my site. One of them is for eBay, the file grabs the query string "eUrl" then encodes it, ads it to the end of another part of the new url then redirects. It works awesome except for ampersands which some eBay urls have.
I've simplified the code so it just displays the output for testing....
Here's a sample that breaks...
http://www.coincommunity.com/UrlTest.asp?eUrl=http://cgi.ebay.com/ws/eBayISAPI.dll?ViewItem&item=330294744298
You'll see that it just stops at the ampersand.
Any ideas?
Thanks!<
I'm working on a redirection file for my site. One of them is for eBay, the file grabs the query string "eUrl" then encodes it, ads it to the end of another part of the new url then redirects. It works awesome except for ampersands which some eBay urls have.
I've simplified the code so it just displays the output for testing....
Code:
<%
Dim eUrl
eUrl = Server.URLEncode(Request.QueryString("eUrl"))
Response.write (eUrl)
%>
Here's a sample that breaks...
http://www.coincommunity.com/UrlTest.asp?eUrl=http://cgi.ebay.com/ws/eBayISAPI.dll?ViewItem&item=330294744298
You'll see that it just stops at the ampersand.
Any ideas?
Thanks!<
Posted
Try removing \= at inc_func_common edit_hrefs function...
<
Posted
Sorry I should have explained a little better. This has nothing to do with the forum, it's a completely stand alone file.<
Posted
You should encode it before you send it to your URLtest.asp
Like you get url , http://cgi.ebay.com/ws/eBayISAPI.dll?ViewItem&item=330294744298 right?
Then you encodeURL this... and finally put
http://www.coincommunity.com/UrlTest.asp?eUrl=<encoded url>
If this is done by javascript, you can do it with encodeURIComponent(url)
So in other words, you have to do encoding at script who sends this url to your urltest.asp, not in urltest.asp
if you can't do any modifications, you can simply use trick which may be dangerous if you have other variables...
Like
eURL = Right(Request.QueryString,Len(Request.QueryString)-5)
(5 because of total letters of "eURL=")
<
Like you get url , http://cgi.ebay.com/ws/eBayISAPI.dll?ViewItem&item=330294744298 right?
Then you encodeURL this... and finally put
http://www.coincommunity.com/UrlTest.asp?eUrl=<encoded url>
If this is done by javascript, you can do it with encodeURIComponent(url)
So in other words, you have to do encoding at script who sends this url to your urltest.asp, not in urltest.asp
if you can't do any modifications, you can simply use trick which may be dangerous if you have other variables...
Like
eURL = Right(Request.QueryString,Len(Request.QueryString)-5)
(5 because of total letters of "eURL=")
<
Last edited by SiSL on 28 December 2008, 11:35
Posted
Now I'm confused. I thought the entire purpose of Server.URLEncode was so I wouldn't have to encode it myself, which is exactly what I'm trying to avoid. Am I wrong?<
Last edited by bobby131313 on 28 December 2008, 11:43
Posted
Ofcourse, but you are UrlEncoding at wrong ASP :)
How would ASP handler be certain if "&view=" is in eURL variable or as another variable? <
How would ASP handler be certain if "&view=" is in eURL variable or as another variable? <
Last edited by SiSL on 28 December 2008, 11:44
Posted
Ahhhh... OK, I think I get it now.
It's not the encode fuctions fault, that part of eUrl is left off so it's not even there to encode right?<
It's not the encode fuctions fault, that part of eUrl is left off so it's not even there to encode right?<
Posted
Yup, you have to use encode at whichever page sends url to this asp , not inside this one...
<
<
Last edited by SiSL on 28 December 2008, 11:58
Posted
Thanks for your help, I learned something today.
<
Posted
Email Member
Message Member
Post Moderation
FileUpload
If you're having problems uploading, try choosing a smaller image.
Preview post
Send Topic
Loading...