0

I'm writing an application which requires me to embed .aspx pages into a dll. Previously I had a httphandler process all these pages and I built them up line by line in code. I have learned that I can actually use the VirtualPathProvider to serve up the embedded content. With the layout and what I am wanting to achieve I'm having a little trouble.

What I had previously with the httphandlers was one dll project and one website project within the solution. The website project was totally empty apart from a web.config. The only alteration to this was the standard httphandler section pointing all website calls to my dll project which then served up the pages that it contained or passed the request back to IIS if the page didn't exist in my dll.

This is what I'm trying to achieve now but using VirtualPathProvider instead. I still want literally nothing within the website project but I can't seem to get the http request to go across to the dll project. I've got the MSDN example working perfectly within it's own project (everything is in one web project), what I'm trying to do is split them out.

Is this even possible? I'd presume it is but I can't find any examples anywhere, everyone wants to use this in the one project and not split them out.

The idea is to allow minimal setup by the client, the first one was installed by dropping the dll in the Bin directory and then adding 3 lines to the web.config and that was it.

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
  • Am not sure I understand your question, are you looking for `HostingEnvironment.RegisterVirtualPathProvider`? http://msdn.microsoft.com/en-us/library/system.web.hosting.hostingenvironment.registervirtualpathprovider.aspx – Chandu Sep 15 '13 at 16:20
  • Yes....however this as far as I understand would need to be in the web project code, not the dll code if I understand correct. I require something simple like just adding a few lines to the web.config. – user2761804 Sep 15 '13 at 16:30
  • Looks like there is no event to subscribe for during HostingEnvironment Startup. Will update you if I can find a better way to handle this – Chandu Sep 16 '13 at 02:31
  • Haven't tried/tested this but if you are using Asp.Net 4 have a look at PreApplicationStartMethodAttribute http://msdn.microsoft.com/en-us/library/system.web.preapplicationstartmethodattribute.aspx – Chandu Sep 18 '13 at 00:32
  • Will give it a try to validate this approach once I get a chance. Meanwhile if you were able to resolve this, pls update the post – Chandu Sep 18 '13 at 01:32

0 Answers0