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

Response.TransmitFile followed by Response.Redirect

Status
Not open for further replies.

inner

Programmer
Dec 7, 2006
2
US
Hi. I'm having trouble getting my ASP.NET page to work correctly. I would like to know if this is possible and if so, how do I do it.

When the user clicks a link, it should download a file (using either Response.TransmitFile or Response.BinaryWrite). It should also refresh the page or at least be able to redirect to another page, making it appear that the page has refreshed. Is this possible?
 
What bit of your code are you having problems with? Please post what you have attempted so far...


____________________________________________________________

Need help finding an answer?

Try the Search Facility or read FAQ222-2244 on how to get better results.

 
Here is the code:

Response.ContentType = GetContentType(filename);
Response.AddHeader("content-disposition", "attachment; filename=" + filename);
Response.TransmitFile(fullFilename);

// Go to the document page
if (Request.QueryString["rtd"] != null)
{
Response.Redirect("/Document.aspx?documentID=" + Request.QueryString["documentID"]);
}

Looking at it, I know it won't redirect due to the fact that I'm setting the content type and a custom header. I think what I'm really looking for is an alternative way of doing this.

I need the document to open while simultaneously refreshing the page the user is on.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top