Domanda

I coded a simple HttpModule in .net that authenticate user against a database for non .net files.

In IIS 6 I've map the .htm and .pdf extension to be executed by C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dll and everything is working well.

Now I wan't to do the same thing for Classic asp pages but the .asp extension is already mapped to C:\WINDOWS\system32\inetsrv\asp.dll and mapping it to C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dll is not working because there is no build provider for classic ASP in .net.

Here is how my web.config file look like:

    <system.web>
    <authorization>
        <deny users "?" />
    </authorization>
    <compilation>
        <buildProviders>
            <add extension=".asp" type="System.Web.Compilation.PageBuildProvider" />
            <add extension=".htm" type="System.Web.Compilation.PageBuildProvider" />
            <add extension=".pdf" type="System.Web.Compilation.IgnoreFileBuildProvider" />
        </buildProviders>
    </compilation>
    <httpHandlers>
        <add path="*.asp" verb="*" type="System.Web.UI.PageHandlerFactory" validate="false"/>
        <add path="*.htm" verb="*" type="System.Web.UI.PageHandlerFactory" validate="false"/>
        <add path="*.pdf" verb="*" type="System.Web.StaticFileHandler" validate="false"/>
    </httpHandlers>
    <httpModules>
        <add name="MyAuthenticationModule" type="Authentication.MyAuthenticationModule, Authentication"/>
    </httpModules>
</system.web>

Is there a solution?

È stato utile?

Soluzione

ASP.Net for the most part will not correctly interpret classic ASP file. If you have a very simple classic ASP page, with perhaps only a few very simple server expressions, such as a <%=Date() %> or two, you might get very lucky and find that the code still works... but I wouldn't count on it.

You can have classic ASP pages live in the same IIS web site as ASP.Net pages, but you still need to have those pages configured so that the classic ASP interpreter is responsible for them. You can also configure authentication to happen at the IIS level, or configure ASP.Net and ASP classic to share an authentication token/cookie, so that a user logs into an ASP.Net site once and the classic ASP pages are still protected by that single authentication event. However, getting this set up and working correctly is not an easy operation.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top