Web Resources and design-time rendering

Web Resources just work as you'd want to at design-time. Automatically!
In my last post, I left out the design-time aspects of Web Resources for a future post. Web Resources just work at design-time as one would hope for. Automatically! Yep, no more temp files or other painful-to-describe hacks at design-time. For example, here's a screenshot of the TreeView control showing its packaged image resources when the "XPFileExplorer" built-in ImageSet is selected (enabled in the post-PDC builds):

Web Resources in action at design-time


What's happening? The design surface such as the one in Visual Studio implements the IResourceUrlGenerator service. Instead of returning a WebResource.axd URL, the GetWebResourceUrl() method detects design-mode and delegates to the service implementation, which returns a special URL. That special URL gives the design surface a hook to load in the assembly resource when it is referenced in the design-time HTML. Your rendering code remains unchanged, and does not need to check for design-mode. It just needs to keep using GetWebResourceUrl off the Page.

If you're curious, the special URL takes the form of mvwres://<assembly_name>,<resource_name>, where "mvwres" is a custom protocol (used instead of the default "http" protocol).

We've done a lot to make it easier and possible to write more powerful server controls in Whidbey. Web Resources are just one of the features in that vein. Hopefully I've covered all about them now...
Posted on Saturday, 12/6/2003 @ 3:10 AM | #ASP.NET


Comments

2 comments have been posted.

Vimal Subramanian

Posted on 12/9/2003 @ 9:22 PM
Could u shed more light on that custom protocol? THANKS

abc

Posted on 2/1/2005 @ 10:26 AM
<input id=1 type=submit>sampletext</input>
&lt;input id=2 type=submit&gt;sampletext&lt;/input&gt;
The discussion on this post has been closed. Please use my contact form to provide comments.