We are excited to announce that the IIS.NET Forums are moving to the new Microsoft Q&A experience. Learn more >

"Check if file exists" replacement in IIS7RSS

12 replies

Last post Aug 26, 2010 11:12 AM by valliappan

  • "Check if file exists" replacement in IIS7

    Mar 28, 2007 09:46 PM|steve schofield|LINK

    This is what this option is called in IIS6 - "Check file exists?".  What is the option called in IIS7?  Is it the options under Request Restrictions?

    Steve Schofield
    Windows Server MVP - IIS
    http://iislogs.com/steveschofield
    http://www.IISLogs.com
    Log archival solution
    Install, Configure, Forget

  • Re: "Check if file exists" replacement in IIS7

    Mar 28, 2007 09:50 PM|anilr|LINK

    Under request-restrictions, there is a mapping tab - selecting "Invoke handler only if request is mapped to file" is equivalent to "check if file exists".

    Anil Ruia
    Software Design Engineer
    IIS Core Server
  • Re: "Check if file exists" replacement in IIS7

    Mar 28, 2007 10:22 PM|steve schofield|LINK

    Thanks for the clarification.  That was the closest thing I could find.  I couldn't find anything in the help file mentioning this change in wording. 

    Steve Schofield
    Windows Server MVP - IIS
    http://iislogs.com/steveschofield
    http://www.IISLogs.com
    Log archival solution
    Install, Configure, Forget

  • Re: "Check if file exists" replacement in IIS7

    Mar 29, 2007 12:15 PM|peterrow|LINK

    Hi,

    Unless I being completely stupid (quite possibly) you answer is wrong.

    I need to set up what in IIS 6 were script mappings to the ASP.NET ISAPI DLL for the following extensions .rpx, .ArCacheItem and .ActiveReport.  The .rpx one should be set to "check if file exists", the other 2 are virtual and should NOT "check if file exists".

     I add them in and go to the mappings tab and ensure that the "Invoke handler only if request is mapped to file" checkbox is ticked for .rpx and clear for the other two. I run my web app via VS 2005 SP1 on Vista Business and sure enough when the report web viewer control shows an error from IIS saying  - quote:

    "

    HTTP Error 404.0 - Not Found

    Description: The resource you are looking for has been removed, had its name changed, or is temporarily unavailable.

    Error Code: 0x80070002

    Notification: MapRequestHandler

    Module: IIS Web Core

    Requested URL: http://localhost:80/Spocc.Net/secure/1508515872_1387098856_336936641_96617970.ArCacheItem

    Physical Path: C:\Usr\SPOCC\Trunk\Spocc.Net\secure\1508515872_1387098856_336936641_96617970.ArCacheItem

    Logon User: Anonymous

    Logon Method: Anonymous

    Handler: StaticFile

    Most likely causes:

    • The directory or file specified does not exist on the Web server.
    • The URL contains a typographical error.
    • A custom filter or module, such as URLScan, restricts access to the file.

    What you can try:

    • Create the content on the Web server.
    • Review the browser URL.
    • Create a tracing rule to track failed requests for this HTTP status code and see which module is calling SetStatus. For more information about creating a tracing rule for failed requests, click here.

    More Information... This error means that the file or directory does not exist on the server. Create the file or directory and try the request again.


    Server Version Information: Internet Information Services 7.0. "

    I have to say I did not expect what you said to work from reading the IIS 7.0 help file and MSDN entries. If i've got some thing wrong or there is some other option in IIS 7 that could affect this then please tell me as I have no clue as to what to try next.

    Regards,

    Peter

    IIS7 script mapping check file exists

  • Re: "Check if file exists" replacement in IIS7

    Mar 29, 2007 12:46 PM|anilr|LINK

    Note in the error message, it says

    Handler: StaticFile

    so your new handler is not even being used for this request - what is the exact handler you added.

    Anil Ruia
    Software Design Engineer
    IIS Core Server
  • Re: "Check if file exists" replacement in IIS7

    Mar 29, 2007 02:59 PM|peterrow|LINK

    Hi,

    I went selected my application under the default web site, went to Handler Mappings area, clicked the "Add script mappings..." option. Entered the extension (.ArCacheItem) in the request path, for executable I browsed to and selected the aspnet_isapi.dll in .NET 2.0 directory, gave it a suitable name. I repeat this for all 3.

    ... then as you post to the original poster implied, for the 2 that I did not want to "check file exists" I clicked the request restrictions button and on the mapping tab of the following dialog cleared the "invoke handler only if request is mapped to:" checkbox. Clicked ok on all dialogs and received a message box which asked me since this was an ISAPI I was adding did I want to add it to the allow permissions list to which I answered yes.

    Not only did this not work but in the custom section of my web.config it removed all the values of the tags. For example where previously there was a tag <allowPublicSearch>Yes</allowPublicSearch> after adding the mentioned script mappings this got replaced with <allowPublicSearch></allowPublicSearch> as did all my other tags. However that's a different issue and something I could live with for a while if only these mappings would work.

    Regards,

    Peter

    iis7 check file exists

  • Re: "Check if file exists" replacement in IIS7

    Mar 29, 2007 03:28 PM|anilr|LINK

    Can you cut-n-paste the handler section from the web.config file?  I think you may have done .extension instead of *.extension

    Anil Ruia
    Software Design Engineer
    IIS Core Server
  • Re: "Check if file exists" replacement in IIS7

    Mar 30, 2007 03:56 AM|peterrow|LINK

    AH! DOH!

    Thanks it seems that one single character missing - namely * - was stopping this from working. Although slightly annoying that the IIS dialog for adding the mapping doesn't either (a) add it automatically or (b) prompt you to add it.

    Now if only it would stop wiping custom tag values whenever you add script maapings I'd be all set.

    doh check if file exists

  • Re: "Check if file exists" replacement in IIS7

    Mar 30, 2007 10:19 AM|anilr|LINK

    There are cases where you do not want the * - eg look at any of the foo.axd mappings, they want to match specific axd's and not a wildcard.
    Anil Ruia
    Software Design Engineer
    IIS Core Server
  • Re: "Check if file exists" replacement in IIS7

    Aug 21, 2008 10:40 AM|GlenConway|LINK

    Hi Guys - I've followed these instructions on Windows Server 2008 x64 but still can't get this thing to work :-(  I have created a virtual directory that is using a classic app pool and when I go into the HttpHandlers module and create the mappings, the following entries are created in the web.config file:

     <handlers>

    <add name="RPX" path="*.rpx" verb="*" modules="IsapiModule" scriptProcessor="C:\Windows\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dll" resourceType="File" preCondition="classicMode,runtimeVersionv2.0,bitness32" />

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

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

    </handlers>

    I'm at a loss as to why I get a 404 error trying to view a report.  Anybody help? :-)

    Thanks

    Glen

     

  • Re: "Check if file exists" replacement in IIS7

    May 08, 2009 04:34 PM|mkasa|LINK

    In my case ".ashx" handers was placed in same folder. So i replaced the "~" path because all my code was in same folder. It solved the "404 Not Found" It seems that sometime the path define with symbol "~" won't work due to unknown reason.  This might be a Url rewriting issue.
    Muhammad Kashif Azeem
  • Re: "Check if file exists" replacement in IIS7

    Feb 11, 2010 04:26 AM|mothswiller|LINK

    GlenConway

    Hi Guys - I've followed these instructions on Windows Server 2008 x64 but still can't get this thing to work :-(  I have created a virtual directory that is using a classic app pool and when I go into the HttpHandlers module and create the mappings, the following entries are created in the web.config file:

     <handlers>

    <add name="RPX" path="*.rpx" verb="*" modules="IsapiModule" scriptProcessor="C:\Windows\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dll" resourceType="File" preCondition="classicMode,runtimeVersionv2.0,bitness32" />

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

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

    </handlers>

    I'm at a loss as to why I get a 404 error trying to view a report.  Anybody help? :-)

    Thanks

    Glen

     

     This is exactly the issue I was having. I have a custom extension .cspx and I need the ISAPI dll to handle it where no file exists.

    I did manage to get it to work by changing to 64bit:

     

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

  • Re: "Check if file exists" replacement in IIS7

    Aug 26, 2010 11:12 AM|valliappan|LINK

     http://msdn.microsoft.com/en-us/library/bb515343.aspx

     Basically add a managed handler, for that particular extension (one by one) and restart web site. It should work.