// Response. setheader ("content-disposition", "inline; filename=test1.doc "); // Open with IE for online browsing Response. setheader ( " Content-Disposition " , " Attachment; filename=test1.doc " ); // Download Method, download, open without a browser Response. contenttype = " Application/octet-stream " ; Response. addheader ( " Content-Disposition " , " Attachment; filename=ciwong.doc " ); String Strdoc = This . Renderview ( " View " ,New Examination. Mapping. Entities. Examination () {examinationid = Id}); response. contenttype = " Application/MS-Doc " ; Response. Write (strdoc); response. Flush (); response. End (); response. Close ();
// Download the Remote Image
Public StaticSystem. Drawing. Image downimg (StringURL) {webrequest wreq=Webrequest. Create (URL); wreq. Timeout=10000; Httpwebresponse wresp=(Httpwebresponse) wreq. getresponse (); stream s=Wresp. getresponsestream (); system. Drawing. Image img=System. Drawing. image. fromstream (s); IMG. Save (filename, imageformat. JPEG); IMG. Dispose (); S. Dispose ();ReturnIMG ;}
// Response. setheader ("content-disposition", "inline; filename=test1.doc"); // open the file in IE
Response. setheader ("content-disposition", "attachment; filename=test1.doc"); // download method, which can be opened without a browser
Response. contenttype = "application/octet-stream ";
Response. addheader ("content-disposition", "attachment; filename=ciwong.doc ");
String strdoc = This. renderview ("View", new examination. Mapping. Entities. Examination () {examinationid = ID });
Response. contenttype = "application/MS-Doc ";
Response. Write (strdoc );
Response. Flush ();
Response. End ();
Response. Close ();