开发者

How can I download a file through my application

开发者 https://www.devze.com 2022-12-09 22:25 出处:网络
Hai Guys., Im doing an Application titled Online Educatio开发者_如何学Pythonn. In my application i have to enable the trainees to download the pdf tutorials that i\'ve been already stored in database

Hai Guys.,

Im doing an Application titled Online Educatio开发者_如何学Pythonn. In my application i have to enable the trainees to download the pdf tutorials that i've been already stored in database.How can I do this process using C#.Net..,

Thanks in advance for those who answer this question....,

Shankar.


So you are already putting your file in DB?

To allow users download file you should use Response.BinaryWrite. You will also need to send some special headers to user.

All in all the code looks like this:

  Response.ContentType = "Application/pdf";
  Response.AppendHeader( "content-disposition", "attachment; filename=" + name );
  Response.BinaryWrite(data);
  Response.End();


Pass the file to the response stream with the appropriate content type set. Then the browser will open a dialog to save or open the document.

File download using C#

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号