Override some Methodes of VirtualPathProvider

379 Views Asked by At

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

1

There are 1 best solutions below

6
On BEST ANSWER

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());
}