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 712381
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T04:50:30+00:00 2026-05-14T04:50:30+00:00

I searched high an low and still cannot find a definite answer. How do

  • 0

I searched high an low and still cannot find a definite answer.

How do I configure IIS 7.0 or a Web Application in IIS so that ASP.NET Runtime will handle all requests — including ones to static files like *.js, *.gif, etc?

What I’m trying to do is as follows.

We have kind of SaaSy site, which we can “brand” for every customer. “Branding” means developing a custom master page and using a bunch of *.css and other images.

Quite naturally, I’m using VirtualPathProvider, which operates like this:

public override System.Web.Hosting.VirtualFile GetFile(string virtualPath)
{
    if(PhysicalFileExists(virtualPath))
    {
        var virtualFile = base.GetFile(virtualPath);
        return virtualFile;
    }

    if(VirtualFileExists(virtualPath))
    {
        var brandedVirtualPath = GetBrandedVirtualPath(virtualPath);
        var absolutePath = HttpContext.Current.Server.MapPath(brandedVirtualPath);

        Trace.WriteLine(string.Format("Serving '{0}' from '{1}'", 
            brandedVirtualPath, absolutePath), "BrandingAwareVirtualPathProvider");

        var virtualFile = new VirtualFile(brandedVirtualPath, absolutePath);
        return virtualFile;    
    }

    return null;
}

The basic idea is as follows: we have a branding folder inside our webapp, which in turn contains folders for each “brand”, with “brand” being equal to host name. That is, requests to http://foo.example.com/ should use static files from branding/foo_example_com, whereas http://bar.example.com/ should use content from branding/bar_example_com.

Now what I want IIS to do is to forward all requests to static files to StaticFileHandler, which would then use this whole “infrastructure” and serve correct files. However, try as I might, I cannot configure IIS to do this.

  • 1 1 Answer
  • 1 View
  • 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-05-14T04:50:31+00:00Added an answer on May 14, 2026 at 4:50 am

    II7 already does that if the application pool’s Managed Pipeline Mode is set to Integrated which is the default. In Integrated mode, ASP.NET handles all requests including those for static objects.

    If you have to leave your application pool in Classic Mode then you need to use the same techniques you would use in IIS 6 to explicitly create handlers for the various static extensions.

    Additional Information Based on Comments: I think your missing piece is creating an HttpHandler to handle the other extensions (.js, .css, etc.). Without this, then ASP.NET will use the default handling for these types of files. You would create a reference to you handler in your web.config. This article is an example of creating an HttpHandler for static files.

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

Sidebar

Related Questions

I've searched high and low for the answer to this and can find nothing
I have searched high and low and cannot find a Samsung Omnia SDK. I
I've searched high and low, but can not find the answer to what I
So I've searched high and low but couldn't find an answer to my question.
I searched high and low but couldn't find a single ebook in a non-english
I have searched high and low for an answer to why query results returned
I've searched high and low for a solution, but can't find one. I'm using
I've searched high and low for something that seems to be a simple task.
I've searched high and low, but I could not find a solution, to what
I've searched high and low for an answer to this so apologies if it's

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.