Valhalla Legends Forums Archive | Web Development | [ASP] Redirect

AuthorMessageTime
Fr0z3N
I am using an option form, the user check the option then submits, it takes the user to 'download.asp?dl=<namehere>' and in the download.asp, I get the game of the file, figure out which file it it then redirect to the file. I amd using Response.Redirect("file.extension") which is not working and Response.Redirect "file.extension" which give me the same error. This error says something about invalid URL. I tihnk I am doing something wrong in the redirect but even when I try Response.Redirect("url/file.extension") I get the same error, any ideas?
May 18, 2004, 2:53 AM
Grok
Questions like this work better when you post the actual code. Use the actual Response.Redirect including the not-working filename parameters.
May 18, 2004, 3:05 AM
Fr0z3N
[code]

<%
response.write("<h2>Warcraft III 1.15</h2>")
response.write("Cracks")
%>

<form action="download.asp" method="post" id=form1 name=form1>

<input type="radio" name="dl"
value="wc3.asp">
RoC/TFT No-CD Crack<br><br>

<input type="submit" value="Go!" id=submit1 name=submit1>

</form>

</body>
</html>
[/code]

Thats default.asp

This is download.asp

[code]
<html>
<body>


<%
if Request.Form("dl")<>"" then
Response.Redirect(Request.Form("dl"))
end if
%>

</body>
</html>
[/code]

wc3.asp just prints hi.
May 18, 2004, 3:18 AM
Grok
You're using method="post" in your form, so you will not have a query string like you wanted.
May 18, 2004, 4:55 AM
Fr0z3N
If I do:

[code]
Response.write(Request.Form("dl"))
[/code]

in download.asp it prints the correct file
May 18, 2004, 10:23 AM
Grok
[quote author=Fr0z3N link=board=22;threadid=6856;start=0#msg60630 date=1084875780]
If I do:

[code]
Response.write(Request.Form("dl"))
[/code]

in download.asp it prints the correct file
[/quote]

Prints the file? Your request said nothing about printing. Please restate the question clearly.
May 18, 2004, 1:31 PM
Spht
[quote author=Fr0z3N link=board=22;threadid=6856;start=0#msg60603 date=1084850307]
[code]

<%
response.write("<h2>Warcraft III 1.15</h2>")
response.write("Cracks")
%>

<form action="download.asp" method="post" id=form1 name=form1>

<input type="radio" name="dl"
value="wc3.asp">
RoC/TFT No-CD Crack<br><br>

<input type="submit" value="Go!" id=submit1 name=submit1>

</form>

</body>
</html>
[/code]
[/quote]

The way you have that set up is if you click no option it'll bring you to download.asp, and if you click "RoC/TFT" option it'll bring you to wc3.asp.

If you want to do the download.asp?name= thing, then do something like:

[code]<input type="radio" name="dl" value="download.asp?name=nocdcrack"> RoC/TFT No-CD Crack[/code]
Then check for "name" query string in download.asp.
May 18, 2004, 5:28 PM
Fr0z3N
Ahhh, I see. Thanks Spht. I'll try it when I get home.
May 18, 2004, 5:57 PM
Myndfyr
A couple things:

[quote author=Fr0z3N link=board=22;threadid=6856;start=0#msg60603 date=1084850307]
[code]

<%
response.write("<h2>Warcraft III 1.15</h2>")
response.write("Cracks")
%>
[/code]
[/quote]
There is absolutely no reason to be making calls to the Response.Write object for constant HTML data that isn't going to be used programatically. It's easy enough just to put HTML there.

[quote author=Fr0z3N link=board=22;threadid=6856;start=0#msg60603 date=1084850307]
[code]
<form action="download.asp" method="post" id=form1 name=form1>

<input type="radio" name="dl"
value="wc3.asp">
RoC/TFT No-CD Crack<br><br>

<input type="submit" value="Go!" id=submit1 name=submit1>

</form>

</body>
</html>
[/code]

Thats default.asp

This is download.asp

[code]
<html>
<body>


<%
if Request.Form("dl")<>"" then
Response.Redirect(Request.Form("dl"))
end if
%>

</body>
</html>
[/code]

wc3.asp just prints hi.
[/quote]

What I have done to support downloading is make a client-side script that is invoked by a server-side script. Example:
1.) On response to a download request, get the ID of the file from the request
2.) Look into the database to see if the file ID can be found. If not, report the error and exit.
3.) Once retrieving the file ID, put it into this (this is a JScript scriptlet, as in my ASP days that's what I used -- you should be able to convert it easily though):

Server:
[code]
function writeScriptCall(filename) {
Response.WriteLine('<script language="JavaScript">');
Response.WriteLine(' setTimeout("download(\'' + filename + '\');", 3000);');
Response.WriteLine('</script>');
}
[/code]
This server code tells the client to call a function called "download", with a single parameter, 3000 seconds after the script execution engine hits the call to setTimeout. This code should be included in the client:
[code]
function download(file) {
window.location = file; // modify this string to be the location of your file, for example, "./files/" + file;
}
[/code]

Anyway, hth.
May 18, 2004, 5:58 PM
St0rm.iD
Request("bleh")
May 19, 2004, 7:08 PM

Search