IIS such as .aspx.cs.txt.html on the normal web server will explain and execute
. CS and so on are inaccessible by default. Data streams are required to download this file!
Ignore IIS
CodeAs follows. 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 is a stream that cannot be read by
// Client and must be downloaded
Response. contenttype = " Application/octet-stream " ;
// Send the file stream to the client
Response. writefile (file. fullname );
// Stop the execution of this page
Response. End ();
}