Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Meaning of path attribute on handlers in web.config

I'm looking at IIS7.5 configuration (system.webServer/handlers).

Do you know what is the diference between \*. and \* in the path argument for handlers? Could you use file.* (to match file.txt and file.xml) or abc.a?c (to match abc.abc and abc.asc) ?

Can the path argument make reference to the "folder"? like \*\f4\*.txt?

Given a http request like

    GET \f1\f2.f3\f4\a.b.c?arg1.arg2.arg3=3&arg4.txt=1.4

what is the part the path argument tries to match?

like image 982
Eduard Avatar asked Aug 12 '11 11:08

Eduard


1 Answers

The * and *. paths aren't really "wildcard" mappings in the sense of matching some pattern in your URL.

The * handler handles requests for all content that doesn't match any paths (or verbs/preconditions) already specified in the HTTP handlers for the site. The HTTP handler list is actually an ordered list, the default view in IIS7's MMC can be misleading if you sort by path. To see the true processing order you should click on the *View Ordered List" link in the right hand side Actions Pane.

When you do this you'll see that the * handler comes last and is called the StaticFile handler. There may be some others such as the TRACEVerbHandler and the OPTIONSVerbHandler which only respond to the TRACE and OPTIONS verbs which you can generally ignore as they are not executed under normal operation.

The *. handler is specific to ASP.NET 4.0 and is added when you install ASP.NET 4.0. This handler is there to provide support for extensionless URLs. Initially this handler does nothing and only comes into play when you install the KB980368 hotfix (which is also rolled into Windows 2008R2/Windows 7 Service Pack 1).

There's a couple of great articles by Thomas Marquardt about the *. handler and extensionless urls:

How ASP.NET MVC Routing Works and its Impact on the Performance of Static Requests
How Extensionless URLs Are Handled By ASP.NET v4

There's quite a lot to absorb initially in those articles and you may need to revisit the fundamentals of the IIS7 pipeline to get your head around them (it took me a few reads for the material to sink in), but stick with it.

like image 190
Kev Avatar answered Oct 05 '22 10:10

Kev