Topics: Business Logic Layer
Jan 14, 2014 at 3:59 PM
At the website I'm creating I'm uploading html files (results from competitions etc.).
When I click on such a link the browser (just tested Firefox) wants to download the file before opening it.
In the ProcessRequest method in the FileHandler found in HttpHandlers I replaced
with this:
if (fileName.ToLower().EndsWith(".html"))
   context.Response.ContentType = "text/html";
   context.Response.WriteFile(string.Format("{0}files{1}", Blog.CurrentInstance.StorageLocation, fileName));
and it works.
However I try to not to make my alterations in the code, instead use extensions and widgets to keep it clean and avoid mistakes in future updates.
Can I accomplish this?