Reputation: 101192
I got a VirtualPathProvider
which I register with HostingEnvironment.RegisterVirtualPathProvider(new MyVirtualPathProvider())
in global.asax.
The FileExists
method is called for my screen.js
and returns true
, but the GetFile
method is never called. Why do it check for the file but do not try to use it?
How can I fix it?
Upvotes: 3
Views: 1510
Reputation: 16174
The logic actually used is if the file exists then IIS must be able to serve it directly and ASP.NET doesn't need to do anything more. If the file extension is .aspx, IIS will then pass it back to ASP.NET and GetFile will be called.
You could try having asp.net handle all .js files or something like that, but the easiest solution in this case is probably to add a route that matches the file url and calls a controller action that sends the file.
Upvotes: 1