How to make accessible Static Files

Topics: General, Writing modules, Writing themes
Sep 17, 2014 at 4:48 PM
Hi there,

I am trying to make SEO to my webpages. Some google tools need to access a static web page in root folder. In short: I need to make accessible this page in my website:

Off course it cannot be reached when i try to browse, and therefore the Google tools neither.

So i searched a bit and i found this:
<add path="google1151360b15616b45.html" verb="GET" type="System.Web.StaticFileHandler" />

And also this inside webserver tag:

<handlers accessPolicy="Script,Read">
       <!--clear all handlers, prevents executing code file extensions, prevents returning any file contents--> 

      <add path="google1151360b15616b45.html" verb="GET" modules="StaticFileModule" preCondition="integratedMode" resourceType="File" requireAccess="Read" />
       <!--Return 404 for all requests via managed handler. The url routing handler will substitute the mvc request handler when routes match.--> 
      <add name="NotFound" path="*" verb="*" type="System.Web.HttpNotFoundHandler" preCondition="integratedMode" requireAccess="Script"/>
I put that in web.config and i got an 500 error!


!!!!!!!!!!!!!! I just want to be able to access static files!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Sep 19, 2014 at 3:25 PM
Sep 19, 2014 at 3:28 PM
It did not work for me.. anyway i will do it again, maybe i missed something.. thx!
Oct 14, 2014 at 2:30 PM
Here is Web.config which works for me.
I needed to add handler and also mimeMap for specific file extension

<?xml version="1.0" encoding="UTF-8"?>
  <clientCache cacheControlMode="UseMaxAge" cacheControlMaxAge="7.00:00:00" />      
  <mimeMap fileExtension=".bgd" mimeType="text/plain" />
<handlers accessPolicy="Script,Read">
    <add name="StaticFile" path="*" verb="*" modules="StaticFileModule" preCondition="integratedMode" resourceType="File" requireAccess="Read" />      
Oct 14, 2014 at 2:35 PM
Thx too much!! i got it working!!