Question

I want to use the default implemented VirtualPathProvider of ASP.Net MVC Web Application.

In other words I want to inherit my own VirtualPathProvider from default Asp.net VirtualPathProvider and just override the GetCacheKey Method.

What should I do?

Anyone can help?

Cheers

Was it helpful?

Solution

Create your custom virtual path provider class, overriding the method you want, and then call HostingEnvironment.RegisterVirtualPathProvider from within Application_Start (defined in global.asax.cs) to install it:

protected void Application_Start() {
    HostingEnvirontment.RegisterVirtualPathProvider(new MyVPProvider());
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top