PDA

View Full Version : redirection script causing download...


Mhtml
09-13-2002, 11:35 AM
Ok problem. I have a redirection script :

<% dim GetQueryStr ScriptsPage, TutorialsPage, DownloadsPage, ContactPage
ScriptsPage = Server.MapPath("scripts.asp")
TutorialsPage = Server.MapPath("tutorials.asp")
DownloadsPage = Server.MapPath("downloads.asp")
ContactPage = Server.MapPath("contact.asp")

GetQueryStr = Request.QueryString("s")

if GetQueryStr = scripts then
Response.Redirect(ScriptsPage)
end if


and it just goes on like that, and I send the ?s=scripts or whatever section the link goes to but I just get a download window for my .asp file being loaded but if I just type in the address the page comes up.

Also how can I make the script smaller, I'm not sure how to use arrays.

whammy
09-13-2002, 02:17 PM
The problem with that script is you're using Server.MapPath - which maps the LOCAL path to the file. If the pages are in the same directory, just use the page name and it should work... no need to use anything else.

As a matter of fact if all of your querystrings are the name of the page, as "scripts" is, you could even do:

redir = Request.QueryString("s")

If redir <> "" Then
Response.Redirect(redir & ".asp")
End If

Mhtml
09-14-2002, 12:00 AM
Thanks Whammy, I had a feeling that it weas something like that but being new to asp I wasn't sure...

Thanks.

whammy
09-14-2002, 07:28 AM
:cool: