Download file returning 0 K Byte with http: but with Physical path

G

Guest

private void Button1_Click(object sender, System.EventArgs e)
{

Context.Response.Clear();
Context.Response.ContentType = "application/octet-stream";
Context.Response.AppendHeader("accept-ranges", "bytes");
Context.Response.AddHeader("Content-Disposition", "attachment; filename=" +
"test.zip");
Context.Response.BufferOutput = false;

Context.Response.Flush();
Context.Response.TransmitFile("c:\\test.zip");

when I use the Physical path it save the file succeesfully in the
destination folder
but when I replace the above Physical path line with the below virtual path
line it dowload the file successfully but with 0 KByte.

Context.Response.TransmitFile("http://test.com/Client/test.zip");



//Context.Response.
}
}
}
 
G

Guest

Use MapPath to get the physical path of the location you wish to save the
file at. You can then save to that path and use a relative path to display
the file.

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

***************************
Think Outside the Box!
***************************
 

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

Top