Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9182271
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T18:31:16+00:00 2026-06-17T18:31:16+00:00

Based on this SO answer: https://stackoverflow.com/a/2066040/458354 I have a web.config that defines a custom

  • 0

Based on this SO answer: https://stackoverflow.com/a/2066040/458354 I have a web.config that defines a custom HttpHandler for all files in a subdirectory, placed in my static file subdirectory. This works perfectly if the directory, even when configured as virtual, is on the same server as IIS. However, if the virtual directory points to a shared folder on another server, I receive this error when accessing a static resource: “An error occurred loading a configuration file: Invalid file name for file monitoring: ‘\\remoteserver\remotedir\web.config’.”

I’ve even granted permissions on the remote directory to the IIS_IUSR from the webserver. I suspect the problem is the config path being a share. Any thoughts on an way to allow the virtual dir web.config to be read by IIS?

Alternatively, is there a way to configure the handler path in the site’s normal web.config to cover an entire subdirectory?

Config line in question:

<add name="MyRequestHandler" type="MyApp.StaticFileRequestHandler,
MyApp" path="*" resourceType="Either" verb="GET,HEAD"
requireAccess="Read"/>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T18:31:17+00:00Added an answer on June 17, 2026 at 6:31 pm

    See 401 Unauthorized when custom IHttpHandler tries to read from virtual directory . Set the ApplicationPool identity to the same identity that will be used to connect to the remote virtual directory (could be a service account, for example).

    Also, with regard to alternate ways to assign a Handler to a subdirectory, I ended up changing the application design to use asp.net routing (not MVC) and having the url request specify the desired static file by an identifier (which may not always be desirable, but was already an existing practice elsewhere in our application landscape). This eliminates the need for a child web.config in the virtual directory, as the Handler can then be assigned programatically:

    public static void RegisterRoutes(RouteCollection routes)
    {
        // fileId must be all digits, with at least one digit
        var routeConstraints = new RouteValueDictionary { { "fileId", @"\d{1,}" } };
        var getProtectedFileRoute = new Route("resources/files/{fileId}", new MyFileRequestRouteHandler())
        {
            Constraints = routeConstraints
        };
        routes.Add(getProtectedFileRoute);
    }
    

    The identifier is no longer a wildcard, but a RouteData parameter. (Not sure if this would work if the identifier were a filename with a ‘dot’ and extension…).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Based on the answer I received on this question ( https://stackoverflow.com/questions/1911969/... ) I have
This question is based on an answer I received for another question : https://stackoverflow.com/a/3060233/323357
I'm building an web app that uses this code to search for addresses: http://code.google.com/intl/en/apis/maps/documentation/javascript/examples/places-autocomplete.html
This is a further question based on this answer: How can I implement a
Based on the answer for this question What's the difference between CompositionBatch and catalogs?
Based the accepted answer to this question I've setup a NetBeans/tomcat environment. In testing
This question is based on my previous question which I got a working answer
UPDATE: Solved. Thanks BusyMark! EDIT: This is revised based on the answer below from
Based on some answers to this question it appears that +alloc does some behind-the-scenes
I have tried to find the answer to this question on both the Spring

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.