.netasp.net-mvc-3app-offline.htm

.Net MVC3 app_offline.htm issues with css/images


I'd like to use the root app_offline.htm file as a maintenance page.

Design came back with a maintenance page that will require images and css.

I added the image and ran the site, but the image won't render. I looked in firebug and saw that the image is showing a 503 error (service unavailable). This makes sense seeing as runAllManagedModulesForAllRequests="true" is in the web.config, so all requests will run through .net, hence the error.

I thought I'd be able to do this in the web.config, but no luck:

<location path="offline">
    <system.webServer>
        <modules runAllManagedModulesForAllRequests="false"/>
    </system.webServer>
</location>

Is an app_offline.htm not recommended for MVC? Is there a better alternative?


Solution

  • I didn't even know app_offline.htm worked for MVC :-)

    As an alternative, you could create a global filter or if you have a common controller base class that when the maintenance flag is turned on, redirect all traffic to the maintenance view (flag can be in DB or app config).