Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Yet another 404 page problem in IIS 7

I have an existing web site I need to move to IIS 7. The site (which I don't want to rewrite) uses 404 error to serve pages out of a database. IOW, an url like http://crimson/pages/myPage causes a 404 which then goes to site404.aspx which generates the html from the database.

In IIS6, I set up a wild card handler mapped to aspnet_isapi.dll and mapped 404 to point to my site404.aspx and all worked just fine.

I've done the same thing in my new development server with IIS 7 and can't get it to work.

I'm using Classic.net AppPool The wildcard handler looks like this

<add name="WildCardHandler" path="*" verb="*" modules="IsapiModule" scriptProcessor="C:\Windows\Microsoft.NET\Framework64\v2.0.50727\aspnet_isapi.dll" resourceType="Unspecified" requireAccess="None" preCondition="classicMode,runtimeVersionv2.0,bitness64" />

CustomErrors looks like this:

<customErrors mode="Off" defaultRedirect="url">
        <error statusCode="403" redirect="NoAccess.htm" />
        <error statusCode="404" redirect="/site404.aspx" />
    </customErrors>

On the error pages tab of the site, 404 is mapped to the aspx page and type is set to Execute URL

For all that, I get the following error:

HTTP Error 404.0 - Not Found
The resource you are looking for has been removed, had its name changed, or is temporarily unavailable. Detailed Error InformationModule IIS Web Core 
Notification MapRequestHandler 
Handler StaticFile 
Error Code 0x80070002 
Requested URL http://srvr:80/crimson/articles/index 
Physical Path C:\inetpub\wwwroot\Crimson\articles\index 
Logon Method Anonymous 
Logon User Anonymous 

Thanks for any insight.

like image 532
Jon Avatar asked Nov 05 '22 01:11

Jon


1 Answers

Success is mine!

There is an additional step that's needed to get this to work.

Features View > Error Pages > 404 > Edit Feature Settings

In the resulting Edit Error Pages Settings dialog, choose 'Custom error pages' and then enter the path to the 404 handler and set Path type to 'Execute URL'

Note that

Features View > Error Pages > 404 > Edit

Gives a different dialog which also must be set to Execute URL. Why there are two similar dialogs both of which are needed to get the job done, I don't know. But that's the way it is.

like image 163
Jon Avatar answered Nov 16 '22 08:11

Jon