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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

spaces in QueryString that aren't autoconverted

Status
Not open for further replies.

moogleii

Programmer
Jun 29, 2003
6
US
Hello,

I'm attempting to pass information from an html source (extremely limited, so forms, scripts, etc are all impossible. just a plain old QueryString passed through the URL) to an ASP page.

So basically, the spaces aren't being converted to %20, causing ASP to choke. I've tried URLEncode, escape, and all that, but it's choking before it even gets a chance to parse any part of my ASP pages. In any case, I've been told there is no solution. I just wanted to see if anyone here could offer a solution before I whip out apache.

Thanks in advance
 
Can you post some code or provide a little more description of the problem? I am not sure I completely follow your issue.

Human beings, who are almost unique in having the ability to learn from the experience of others, are also remarkable for their apparent disinclination to do so.
--Douglas Adams
 
When you say you've tried URLEncode and it doesn't work, I don't follow.

If you had a string like:
Code:
This is a string
and you wanted to pass it to a page called mypage.asp in a querystring as a field called mystring, then in ASP you'd use:
Code:
"mypage.asp?mystring=" & Server.URLEncode("This is a string")
which would result in:
Code:
mypage.asp?mystring=This%20is%20a%20string
We need to know which part of that doesn't work correctly for you so we can determine whether it's possible or not.
 
You aren't trying URLEncode on the HTML page are you?

Also, you say that you're using a HTML source, so why does that mean you can't use forms ?

This post is best viewed at 1024 x 768
 
Sorry,

Here's some clarifications.

The starting page is a regular old htm page, so no i'm not running any asp code on it. The user browser is a custom browser, with an older implementation of mozilla. So that's why there won't be any forms or scripts available. And that's why I believe the spaces aren't being autoconverted to %20.

I'm trying to pass information to an asp page so that I can break out of the dinosaur age, and use some asp tech.

Genimuse, that won't work because it's choking before any of the asp code runs. Plus mystring isn't hardcoded

So, for example.

192.168.0.1/default.asp?mystring=Carls Jr is the HREF

Spaces aren't being autoconverted, so I end up with Carls Jr

Before any code in default.asp runs, I get an error. Even if I dont operate or examine mystring in any way, I get an error, which is why I think it's choking in the ASP server.

 
So i know that the spaces aren't being converted to %20.

So, from above, in default.asp, i'll attempt to rectify that by throwing in URLEncode and whatnot.

But that does nothing, because as I was saying, I think it's choking before any of default.asp is parsed.

I dont think ASP likes taking in a variable with spaces to begin with, and I'm not sure how to solve this, since I can't modify the source url by manually adding in %20, because I don't have script tech available to me.

I hope this clarifies things.

Thanks for the quick responses
 
That does help. When you say you're getting an error before any of default.asp is parsed, what precise error are you getting? That is, beyond a 500 error, what does it say (be certain to turn off "friendly HTTP error messages" in IE to get the detailed message)?

It's hard to believe that none of the asp will run, because while the space is an invalid URL character, it's not something that will choke a web server.

Even with the spaces in it, you will be able to parse the raw querystring "manually" by referencing Request.Servervariables("QUERY_STRING").

What is the precise error message?
 
Hmm, but when I hardcode the url, and put in %20's where the spaces are, it runs fine. As it is, with

192.168.0.1/default.asp?mystring=Carls Jr

even if my default.asp only has one code line, say <BR><BR>, or even if it's blank, it won't work.

Unfortunately the custom browser can't display error messages like that. It only has one global error message.

Which reminds me of another question I forgot to ask. Does IIS keep any error logs? Maybe I could see what's going wrong if they exist.

 
Unfortunately, the logs don't even pick up the error. It's as if the site was never visited. If I remove the space to anything else, it logs fine and returns a 204 (which is fine, since my default.asp is empty).

I think this only reinforces that it's choking on the asp end before it even gets a chance to parse the page.

I was using the IIS that comes with XP Professional, so I'm not sure if Win2k3 has added error checking functionality or not.

Seems like there is no workaround. Apache I guess.
 
Hmm. I still seriously doubt it's IIS that's default hanging, but rather something in the code.

Have you tried creating an ASP page that just does this:
Code:
Response.Write(Request.Servervariables(&quot;QUERY_STRING&quot;))
[/code[
to see if [i]that[/i] page hangs when the crummy browser sends the blanks? If that hangs then yeah, you're out of luck. If that doesn't hang then try posting some of the code here so we can help pinpoint the problem.

Or just use Apache and... what, PHP? Perl CGIs?
 
Mmmm like i've been saying before, there is no code.

The default.asp is completely empty. Blank. Nothing. No html or ASP.

Yes, before I had emptied out default.asp, I did try doing just Response.write(Request...), but that failed as well.

So, yeah, I think apache and php i guess.

Thanks for the help though.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top