WebResourceAttribute should be ResourceAttribute?

Nikhil gives a great overview of the problems that the web resource attribute is intended to solve. I think the idea is pretty cool, though the execution could definately be a bit better (especially considering upcoming OS metadata enhancements). My main question is why is all this stuff being done only on the web side through the web resource request handler? The ASP.NET team is going through an aweful lot of work to:

a) make sure resources are secure

b) make sure you can add custom metadata to your resources (such as content-type)

The thing that gets me is that neither of these two things is really web specific. If I have some precious resource embedded in my assembly (lets say some private encrypted string or something), would I not want to protect it from all resource requests, not just web resource requests? Or maybe just requests from Administrators can view this data... sound familiar? We already have all the plumbing via CAS. As far as metadata is concerned, it is a very cool idea to be able to custom embed metadata along with my resources. Taking it one step further (which seems to be what Nikhil is implying is in the stars) I embed and image and its filename, but what if I am making an icon resource and I want to embed the title, description, and size of each icon as well (this could be very useful for automatically filling in those ALT attributes if we are making compliant apps)? Again, these things don't just apply to the web world, they could apply to just about any resource in any app. Of course, you have to stop at some point, these are just resources we are talking about... its not like we need a full file system inside our assemblies. But, if the work is already being done, why not kill two birds with one stone?... heck, just drop the “web“ part from the name and move it into another namespace and you're half way there ;-).

No Comments