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):
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