Global.asax not starting for .aspx pages in IIS7

We are launching a link redirect service, which can process links that have been submitted to it in various formats. One of these formats is to add the destination URL at the end of the link, for example

http: //url.fwd/abcd/http: //www.mydomain.com/page.aspx

I’ve been working on a Windows Server 2003 / IIS6 window for the last two years, but now we are trying to upgrade to Windows Server 2008 / IIS7 and it no longer works.

I read about the colon problem in the url but does not affect pages that do not end with ".aspx". For instance,

http: //url.fwd/abcd/http: //www.mydomain.com/page.php

will redirect the fine.

http: //url.fwd/abcd/http//www.mydomain.com/page.aspx

also works great (note the absence of a second colon). Despite the incorrect URL, it is handled by our URL redirector system, which uses the 404 user page. We had a similar problem in the old system, so the method was written in Global.asax> Application_Error specifically to handle the case ".aspx", and it worked fine.

On our new server, Application_Error never ends up in Global.asax. Instead, I get a System.NotSupportedException - "This path format is not supported." This System.NotSupportedException is the exact case that we are handling on the Global.asax page, so it definitely does not fire.

I changed the registry keys indicated in several forum posts, HKEY_LOCAL_MACHINE \ SOFTWARE \ Microsoft \ ASP.NET VerificationCompatibility = 1 HKEY_LOCAL_MACHINE \ SYSTEM \ CurrentControlSet \ services \ HTTP | Parameters AllowRestrictedChars = 1

I tried changing the handler mapping settings for .aspx.

I tried to configure the application pool to use the classic mode instead of the integrated one, but this leads to a completely different error when static content, such as images and CSS, is not displayed at all. I have verified that static content is enabled in Windows features, and it is. In classic mode, the ".aspx" request generates two Bad Request errors with absolutely no information. The error page code I get is literally

Bad request <html> <body> Bad request </body> </html>

UPDATE: I changed the static Handler Mapping file to the form found on this page http://improve.dk/blog/2006/12/11/making-url-rewriting-on-iis7-work-like-iis6 However, as is true notes the author, this is a hack, not the right way to do things under IIS7. It also fixes the problem of a static file in classic mode. The .aspx pages still throw a classic error.

Any thoughts or introduce into this a lot of attention.

+4
source share
2 answers

IIS 7 Solution

A simple solution in IIS 7 is to add a parameter to your web.config file to tell IIS to process all requests through your Global.asax events. Just add or change this section in the web.config file to include requests:

<system.webServer> <modules runAllManagedModulesForAllRequests="true" /> </system.webServer> 
+7
source

In my case, I published my site in production, and I pass a copy to the App_global.asax.compiled server. For this reason, no events occurred within Global.asax.

Hope all this helps, I lost 8 hours.

0
source

All Articles