• Welcome to Valhalla Legends Archive.
 

[ASP] Redirect

Started by Fr0z3N, May 17, 2004, 09:53 PM

Previous topic - Next topic

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?

Grok

Questions like this work better when you post the actual code.  Use the actual Response.Redirect including the not-working filename parameters.

Fr0z3N



<%
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>


Thats default.asp

This is download.asp


<html>
<body>


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

</body>
</html>


wc3.asp just prints hi.

Grok

You're using method="post" in your form, so you will not have a query string like you wanted.

Fr0z3N

If I do:


Response.write(Request.Form("dl"))


in download.asp it prints the correct file

Grok

Quote from: Fr0z3N on May 18, 2004, 05:23 AM
If I do:


Response.write(Request.Form("dl"))


in download.asp it prints the correct file

Prints the file?  Your request said nothing about printing.  Please restate the question clearly.

Spht

#6
Quote from: Fr0z3N on May 17, 2004, 10:18 PM


<%
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>


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:

<input type="radio" name="dl" value="download.asp?name=nocdcrack"> RoC/TFT No-CD Crack
Then check for "name" query string in download.asp.

Fr0z3N

Ahhh, I see. Thanks Spht. I'll try it when I get home.

MyndFyre

A couple things:

Quote from: Fr0z3N on May 17, 2004, 10:18 PM


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

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 from: Fr0z3N on May 17, 2004, 10:18 PM

<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>


Thats default.asp

This is download.asp


<html>
<body>


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

</body>
</html>


wc3.asp just prints hi.

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:

function writeScriptCall(filename) {
 Response.WriteLine('<script language="JavaScript">');
 Response.WriteLine(' setTimeout("download(\'' + filename + '\');", 3000);');
 Response.WriteLine('</script>');
}

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:

function download(file) {
 window.location = file; // modify this string to be the location of your file, for example, "./files/" + file;
}


Anyway, hth.
QuoteEvery generation of humans believed it had all the answers it needed, except for a few mysteries they assumed would be solved at any moment. And they all believed their ancestors were simplistic and deluded. What are the odds that you are the first generation of humans who will understand reality?

After 3 years, it's on the horizon.  The new JinxBot, and BN#, the managed Battle.net Client library.

Quote from: chyea on January 16, 2009, 05:05 PM
You've just located global warming.

Banana fanna fo fanna