.msg file gives download error .msg file gives download error asp.net asp.net

.msg file gives download error


Found on ASP.NET forum.

Create a handler, download it as a file:

Response.ContentType = "application/vnd.ms-outlook";Response.AppendHeader("Content-Disposition","attachment; filename=Message.msg");Response.TransmitFile(Server.MapPath(YourPathToMsgFile));Response.End();

or change the setting in IIS 6.0:

Select HTTP Header -> click MIME types - > Click New and add ".msg" as extension and "application/vnd.ms-outlook" as MIME type.


using this tag below we can directly mention the file name to the tag.

   <a href="Your File_Location">Download Link</a>

no need to specify the code in the controller.

just add below tag to web.config inside

  <staticContent>    <mimeMap fileExtension=".msg" mimeType="application/octet-stream" /></staticContent>


<system.webServer>       <staticContent>      <mimeMap fileExtension=".msg" mimeType="application/octet-stream" />    </staticContent></system.webServer>