Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

after a long search on the net I did not find a solution how I can do when I click on a document starts its download in the browser ,I need this in my application .net core

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
270 views
Welcome To Ask or Share your Answers For Others

1 Answer

You just need to:

first, set your response mime type:

Response.Headers.Add("Content-Type", "application/pdf"); //for example

second, set following header as a dictate to browsers to download file:

Response.Headers.Add("Content-Disposition", "attachment; filename=foo.pdf"); //for example

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...