« Previous Next »

Thread: IIS 7 *.* request path matching to folder names with . in them!

Last post 07-30-2009 11:49 AM by SimonTurner. 4 replies.

Average Rating Rate It (5)

RSS

Page 1 of 1 (5 items)

Sort Posts:

  • 07-24-2009, 4:59 AM

    IIS 7 *.* request path matching to folder names with . in them!

    Hi Guys,

    I've hit a rather tricky problem with IIS 7. I’ve followed these instructions and set up IIS correctly so that all extension less URL’s are mapped to the ASP.Net handler. 

    http://www.improve.dk/blog/2006/12/11/making-url-rewriting-on-iis7-work-like-iis6

    However, I’ve now hit a problem with folder names that have a “.” In them, e.g:

    /DesktopModules/CISS.SideMenu/

    For some reason IIS is redirecting this to the ASP.net handler because of the “.” in the path.  Following the above instructions the mapping is only set for files although it is getting invoked for folders also.

    Has anyone heard of this occurring before?  Is a possible work around to alter the request path so that it only matches URL’s with no file extension at all and not just a wildcard.  This way the path above would be ignored as it would assume it has an extension of “.SideMenu”.

    Both myself and my webhost have spent hours looking online for this and have hit a brick wall so any help at all would be massively appreciated.

    Thanks again,

    Simon

  • 07-24-2009, 8:45 AM In reply to

    Re: IIS 7 *.* request path matching to folder names with . in them!

    SimonTurner:
    For some reason IIS is redirecting this to the ASP.net handler because of the “.” in the path
     

    Of course it is.  That pattern matches your rewrite rule.  Learn to use regular expressions or stop naming folders with a dot in them.

    Jeff

    Look for Wrox's new book Professional IIS 7 in your local bookstore, or order now at Amazon.com
  • 07-24-2009, 9:01 AM In reply to

    Re: IIS 7 *.* request path matching to folder names with . in them!

    Its strange that its still invoking the handler even when the request is mapped to a folder though.  Should setting it to"file" only not remove this problem?

    Does anyone know the regex that that only matches when there is no file extension.  This would resolve the problem...

  • 07-26-2009, 9:37 AM In reply to

    • anilr
    • Top 10 Contributor
    • Joined on 05-23-2006, 10:13 PM
    • Redmond, WA
    • Posts 2,343

    Re: IIS 7 *.* request path matching to folder names with . in them!

    Those instructions have a lot of inaccuracy.

    a) Setting "Invoke handler only if mapped to file" does not prevent a non-file from being mapped to the handler, the handler is only mapped based on verb and path - it will just prevent the handler from being called, which is happening here.

    b) If you need IIS7 to work exactly like IIS6, you need to put your application in classic mode and add a *-ScriptMap to aspnet_isapi.dll (using the "add Wildcard ScriptMap" link in the context menu) - also on 64-bit machine, make sure to add wildcard mapping to both 32-bit and 64-bit aspnet_isapi.dll.  The change in configuration for StaticFile is neither needed nor helpful.

    c) Keeping IIS7 in integrated mode and setting runAllModulesForAllRequests in the modules section should get you pretty much what you want though without doing all the *-ScriptMap/DefaultHandler stuff (%windir%\system32\inetsrv\appcmd.exe set config "My Site/My App" -section:system.webServer/modules -runAllModulesForAllRequests:true)

    Anil Ruia
    Senior Software Design Engineer
    IIS Core Server
  • 07-30-2009, 11:49 AM In reply to

    Re: IIS 7 *.* request path matching to folder names with . in them!

    Hi Anilr!

    Thanks so much for your help, the instructions you gave for point (c) did the trick and now everything is working perfectly.  Can't thank you enough, as this was certainly a tricky problem to solve and there were certainly no other solutions online.

    All the best.

    Simon

Page 1 of 1 (5 items)
Microsoft Communities