For some files, the default behavior in IIS is to set the content-disposition to “attachment”. You can do this by adding a rewrite rule to your web.config. The following should work:
<rewrite>
<outboundRules>
<rule name="remove cd">
<match serverVariable="RESPONSE_Content-Disposition" pattern="attachment; filename=.+txt$" />
<action type="Rewrite" />
</rule>
</outboundRules>
</rewrite>
This removes the content-disposition header for txt files and should cause the file to be loaded inline, assuming the client’s browser is not overriding the default behavior for the mime type.
Note: You may need to install the
URL rewrite module to your IIS.
-ag-