Unable to run .mdb files present in the ASP.NET application

I am back after a long vacation :o) 

 I was looking at this issue the other day and in fact I was a little surprised to see this behavior. This guy had written an application that calls .mdb files directly. The files are getting displayed on the browser with the help of excel sheet. To my surprise whenever he was trying to do it, he used to get the following error message,

Server Error in '/' Application.

________________________________________

This type of page is not served.

Description: The type of page you have requested is not served because it has been explicitly forbidden. The extension '.mdb' may be incorrect. Please review the URL below and make sure that it is spelled correctly.

Requested URL: /Test/webref-OLS.mdb

________________________________________

Version Information: Microsoft .NET Framework Version: 2.0.50727.42; ASP.NET Version: 2.0.50727.210

It clearly looks like the aspnet_isapi.dll is trying to serve the .mdb file and this extension is forbidden from execution. To fix this issue, I asked him to follow one of the following methods,

 

1) Remove the .mdb extension from the IIS mappings. We don't need to have the .mdb files to be served by the aspnet_isapi.dll at all.

OR

2) Let's have the .mdb files to be served by the aspnet_isapi.dll itself by making the following changes,

In the global web.config file found under c:\Windows\Microsoft.NET\Framework\v2.0.50727\CONFIG folder, comment the following line

<add path="*.mdb" verb="*" type="System.Web.HttpForbiddenHandler" validate="True" /> in the <httpHandlers> section

AND

add the following lines

a) <add path="*.mdb" verb="*" type="System.Web.UI.PageHandlerFactory" validate="True" /> in the <httpHandlers> section

 

b) <add extension=".aspx" type="System.Web.Compilation.PageBuildProvider" /> in the <buildProviders> section