Webmaster Forum Rules | Posting Guide | Contact Us | Testimonials | Contributing Geek Program | Advertise on Geek/Talk
Welcome to the GeekTalk Webmaster Discussion Forums from GeekVillage.com

Click Here To Register. It's Free!

Go Back   geek/talk: Signature-free discourse for serious web publishers > YOUR CREATION: Building & Maintaining A Web Site > Web Development - Programming / Coding
User Name
Password
Register FAQ Calendar Search Today's Posts Mark Forums Read

Reply
 
Thread Tools Display Modes
Old 09-08-2002, 09:08 PM   #1
WildComputer
Registered User
 
WildComputer's Avatar
 
Join Date: Mar 1999
Location: See Answers 2000 Limited
Posts: 2,618
Default ASP: QUERY_STRING vs default.asp

I am trying to get the entire query string when the site is accessing with a URL like

http://www.somesite.com/?xyz

(I want to get the xyz)

If I do

Response.Write Request.ServerVariables("QUERY_STRING")

A link of the above form will not find the query string

BUT

A link of the this form

http://www.somesite.com/default.asp?xyz

(this is the same exact page) will find the query string.

How to work round, and/or what is configured wrong
WildComputer is offline   Reply With Quote
Old 09-10-2002, 02:47 PM   #2
maddeningcrowds
Registered User
 
Join Date: Nov 2001
Posts: 719
Default

Have you tried going straight for request.querystring(variable)

e.g.
mysite.com/?name=bob

<% response.write Request.QueryString("name") %>
maddeningcrowds is offline   Reply With Quote
Old 09-10-2002, 05:40 PM   #3
WildComputer
Registered User
 
WildComputer's Avatar
 
Join Date: Mar 1999
Location: See Answers 2000 Limited
Posts: 2,618
Default

Yep, same problem

There is some discussion about this in the newsgroups plus I posted at www.experts-exchange.com too

I think it might be a bug/limitation in IIS4. A user at experts-exchange.com said this, and there seems to be documentation to confirm

Right now, the best answer I have is to use Javascripts to catch this (I don't want to upgrade to IIS5 just for this), but i'm hoping somebody might hava better answer
WildComputer is offline   Reply With Quote
Old 09-11-2002, 12:17 AM   #4
robhoran
Registered User
 
robhoran's Avatar
 
Join Date: Jul 2002
Location: United Kingdom
Posts: 79
Default

I've done something similiarv for my http://www.gopictures.com site.

The registered users are given a URL such as http://www.gopictures.com/username.

The way I did this was to re-direct the 404 error to a pages called redir.asp

Heres the code for the redir.asp page. Its ASP/VBScript but I guess you could do something similiar with other languages:

redir.asp
-----------------------------
<%

Response.Write Request.ServerVariables("QUERY_STRING")
Foldervalue=split(Request.ServerVariables("QUERY_S TRING"),"/")
Response.Write FolderValue(3)
Response.Redirect "/Public/default.asp?User_ID=" & Foldervalue(3)
%>
robhoran is offline   Reply With Quote
Old 09-20-2002, 06:00 PM   #5
Meltdown
Registered User
 
Join Date: Mar 2001
Posts: 37
Default

Haven't tested but something like this should work

<%

varURL=request.servervariable("HTTP_REFERER")

varFindQuestionMark=InStr(varURL,"?")

varquerystring=mid(varURL,varFindQuestionMark+1,Le n(varURL))

Response.write varquerystring

%>

Meltdown
\\\/////
~ ~
@ @
<
\__/

Last edited by Meltdown; 09-20-2002 at 06:18 PM.
Meltdown is offline   Reply With Quote
Old 09-21-2002, 10:43 AM   #6
WildComputer
Registered User
 
WildComputer's Avatar
 
Join Date: Mar 1999
Location: See Answers 2000 Limited
Posts: 2,618
Default

Anything which does Request.ServerVariables or Request.QueryString doesn't work in IIS4 for the default page, if the page name, default.asp, is omitted.

This is a bug/limitation in IIS4 which is fixed in IIS5. Search google groups and it's all over them

Upgrading to IIS5 is too drastic

It might work (I haven't tried too drastic) to delete the default page, catch in a 404 handler, and then get the server variables

Right now, the best solution I have is to catch the query string in a JavaScript. If the JavaScript also sees the page name is omitted, could redirect so

www.yoursite.com/?xyz becomes www.yoursite.com/default.asp?xyz

Not very good but workable. In my case, I am only interested in handling a particlar query string value, so I adapted the JavaScript to only do a redirect in this case.
WildComputer is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Making ASP pages scnofx Web Design and Webmaster Issues 5 05-17-2001 12:38 AM
ASP kris Web Design and Webmaster Issues 2 12-31-2000 06:55 PM
ASP, CGI, SQL, mySQL ... ... CYBERWORLD Web Design and Webmaster Issues 5 05-24-2000 11:38 PM
Advices on ASP, Visual Basic, Visual C++ fatso Web Design and Webmaster Issues 6 10-19-1999 01:07 PM
ASP Samples/Help WildComputer Web Design and Webmaster Issues 11 07-21-1999 07:44 AM

Please support our advertisers. They ensure our survival.

All times are GMT -5. The time now is 11:16 PM.


GeekVillage.com is copyright © 1998-2014 iOnline Web Design. All rights reserved.
Powered by vBulletin® Version 3.7.4
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.