Double prompt while File download in ASP.NET

A

arc

I am using this simple code snippet in downloading file but it gives me
double prompt while opening the file. Save is fine.
What could be the problem?

private void Page_Load(object sender, System.EventArgs e)

{

string sFilename = Request.QueryString["file"];

string sFile =
System.Configuration.ConfigurationSettings.AppSettings["FilePath"] +
sFilename;

Response.Clear();

Response.ContentType = "application/octet-stream";

Response.AddHeader("content-disposition", "attachment; filename=" +
sFilename.Substring(sFilename.IndexOf("_")+1));

Response.Flush();

Response.WriteFile(sFile);

}

Thanks
Arc
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Staff online

Members online

Forum statistics

Threads
473,767
Messages
2,569,571
Members
45,045
Latest member
DRCM

Latest Threads

Top