views:

92

answers:

3

Hi,

I added the following lines to Application_Start method in global.asax:

var provider = new TestVirtualPathProvider();
HostingEnvironment.RegisterVirtualPathProvider(provider);

Yet the 'TestVirtualPathProvider' is never used when deploying this application in IIS6 (it does in the ASP.NET Development Server).

Edit: the default path provider has always done its job correctly and served (non-embedded) views correctly. The problem is simply that I want to use my own path provider to provide embedded views. So, initially, I already had the following wildcard mapping configured:

Used wildcard mapping screenshot

Any possible reasons why this does not work in IIS6? Are there any other factors (handlers for example) wich might influence the used VirtualPathProvider?

A: 

UPDATE: the fact that you want to handle extension-less URL's is an important point that's not mentioned in the question. Please see this page for help in setting up MVC with IIS 6: http://haacked.com/archive/2008/11/26/asp.net-mvc-on-iis-6-walkthrough.aspx. This should cover your scenario as well.


Most likely the same issue that I answered in this thread: http://forums.asp.net/t/995633.aspx

Basically, add this in your web.config:

<httpHandlers>
  <add path="*" verb="GET,HEAD,POST" type="System.Web.StaticFileHandler" validate="true" />
</httpHandlers>

That other thread has some details that explain why this is necessary.

David Ebbo
I found that link as well. The problem is, they are looking for 'static resources', while I'm looking for extensionless url's (ASP.NET MVC). I'm suspecting that that's where the problem is...
Bertvan
A: 

I believe that you need to use an ISAPI filter in IIS6 to intercept URLs without extensions. Problem is that ISAPI will need to be done in c/c++.

Mike
Yes, and the ISAPI can be ASP.NET. Use a wildcard mapping.
John Saunders
I am using a wildcard mapping (see added screenshot). Or are you talking about a mapping within the web.config as well?
Bertvan
Difference between Isapi extension and Isapi filter. You need to write a filter that changes the upstream URL/extension to be one that is handled by asp.net. This way the user sees no extension and asp.net sees aspx. This will only take a few lines of code in an isapi filter to accomplish.
Mike
A: 

IIS6 is configured to allow only certain extensions to be processed by the ASP.net pipeline. To findout how you can redirct requests check out the post by DocV.

Vinay B R