0

In my application, we have a notification functionality, when a link is completed by an user. That notification will have a link to file stored on server. While sending the notification I'm preparing a link to file like this

<a href='LINKTOFILEOnSERVER'>FileName</a>

This is what also stated here

Now, in the post above there is point to set "content-type" and "Content-Disposition" but I'm not sure how can I set this in my case.

Can anyone help here?

Community
  • 1
  • 1
nrsharma
  • 2,532
  • 3
  • 20
  • 36

1 Answers1

0

The web server which will serve the file will need to set those headers. You cannot set those in anchor element.

If the files are static (physically located on disk), one way to do it for IIS is to set HTTP response headers for all requests coming to the folder where the files are located:

<configuration>     
  <!--set custom headers for "docs" folder -->
  <location path="docs">
    <system.webServer>
      <httpProtocol>
        <customHeaders>
          <add name="Content-Disposition" value="attachment; filename=&quot;file.docx&quot;"/>
          <add name="Content-Type" value="application/octet-stream" />
        </customHeaders>
      </httpProtocol>
    </system.webServer>
  </location>    
</configuration>
Jenya Y.
  • 2,980
  • 1
  • 16
  • 21
  • 1
    you mean that setting will have to be made in IIS, right? if yes, then please update me what is required here? – nrsharma Jun 22 '15 at 06:28