2006-03-03

ASP.NET 2.0 VirtualPathProvider

Wouldn't it be nice in web applications to have all scripts and images embedded in an assembly so that you only had to release one file. Now if you used this common library across more than one project, you may not want to rely upon VS 2005's web deployment project. Each project would then have to be compiled separately.

One method of achieving this would be to use ASP.NET 2.0's VirtualPathProvider. Apparently you should be able to set up certain path's that map to what you want, rather than the filesystem. This could be a database, xml file or in this instance, an assembly.

If I wanted to create an assembly for a client script application, for example a html content editor, that consisted of style sheets, images and script files, the idea would be to map the path, ~/scripts/htmleditor, to a custom VirtualPathProvider. This provider would then read the file from the assembly and return it to the client.

Here are a few links to how to implement:
http://blogs.msdn.com/davidebb/archive/2005/11/27/497339.aspx
http://dotnetjunkies.com/WebLog/teund/archive/2005/02/15/54446.aspx

1 comment:

Anonymous said...

Intercombase - quality translation Documentation any of more than 140 languages. Agricultural Translation, Energy Translation, Pharmaceutical Translation, Scientific Translation - Summit affordable.

Swedish Translation: [url=http://www.intercombase.com]Spanish[/url]