The files on the normal web server are explained in IIS, such as .aspx.cs.txt.html.
.CS, etc. cannot be accessed by default. To implement download this file to use the data stream!
This is not to pay attention to IIS
code show as below. Download.aspx.cs
Private
Void
Page_load
Object
Sender, System.EventArgs E)
{// retrieve the path of the file to download, and create // a FileInfo object to read its properties string path = Server.MapPath (Request.Params [ "File"]); System.IO.FileInfo file = new System. IO.FileInfo (path); // clear the current output content from the buffer Response.Clear (); // add the header that specifies the default filename for the Download / SaveAs dialog Response.AddHeader ( "Content-Disposition", " attachment; filename = " file.Name); // add the header that specifies the file size, so that the browser // can show the download progress Response.AddHeader (" Content-Length ", file.Length.ToString () ); // specify that the response a stream that can not be read by the // client and must be downloaded Response.ContentType = "application / octet-stream" is; // send the file stream to the client Response.WriteFile (fil E.FullName); // stop the execution of this page response.end ();