The difference between the two IgnoreRoute calls from the original message is as follows:
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
This will match resource requests such as /ScriptManager.axd or /Foo.axd/bar/baz.aspx , but will not match the request with any resource *. axd under the root of your site, for example /foo/bar/Baz.axd .
routes.IgnoreRoute("{*allaxd}", new {allaxd = @".*\.axd(/.*)?"});
This call uses a regular expression to match the request to any resource *. axd at any level of your site, for example /foo/bar/Baz.axd . Therefore, this call would be preferable to the first if you link to any axd resources below the root of your site.
If you break the regular expression,. .* At the beginning will match 0 or more characters. \.axd will match the literal string ".axd" , and (/.*)? will not necessarily match a slash followed by 0 or more characters.
* in the URL pattern, {*allaxd} ensures that the entire path is {*allaxd} , not just one section of the path. allaxd is just an arbitrary label given to the agreed part of the path, which in this case will be the whole path. This method of ignoring routes effectively allows you to ignore routes for specific file extensions. You can easily copy this call and make a few changes to ignore routes for * .aspx, * .asmx, etc. Etc.
For detailed routing documentation, I highly recommend the following MSDN page .
Justin holzer
source share