Reputation: 181034
Okay, so ASP.net allows one to embed Images into an Assembly and access them using WebResource.axd.
I just wonder: What are the Pros/Cons of using Web Resources instead of Images in a folder on the Web Server, like how it's being traditionally done?
This article mainly mentions ease of deployment, but that doesn't seem to justify the extra amount of work.
Upvotes: 4
Views: 448
Reputation: 2341
here is the rule i think it is the best, if you have resources that wont change that often like, scripts, images. then you are better embed them in resources.
but if you have resources, that change versions like Jquery, then you should create properties to point to those external resources.
hope this helps
Upvotes: 1
Reputation: 48088
I built custom controls that used by three different applications in same machine. When I maintain scripts for controls, I can forget deploying the new script file to every application.
In this scenario, it's good to embed resources into assembly and deploy assembly to GAC.
But the good point about external files (not embedding resources) is that, sometimes you realize a bug in script files. deploying it without resetting application is a good thing in an online application.
Upvotes: 1
Reputation: 36035
One clear scenario is: third party controls.
I really don't want to deal with different script/image files for controls we are not developing. With embedded resources, its just the .dll file and that's it :).
The same applies if you are developing custom web controls that you will be using across different web sites.
Upvotes: 6
Reputation: 1179
I would not put images into the assembly. It's just too much work for no apparent benefit. Is it faster? Probably not as Reflection-like speeds would be called in to get to the resource. Is it harder to maintain, you bet!
Why would a high-end developer be needed when the business wants to update a logo for example?
Upvotes: 0
Reputation: 2397
For me it is just a an another not-killer-feature added in ASP.NET . I do not think that it was implemented with serving a lot of content in mind but some times the added ease of deployment matters, then you gain some benefit. Question is when?
Microsoft states that they use it for eg. to serve forms validation scripts, and that due to caching it should not affect performance. That creates isolation for the controls and their scripts, so you do not have to worry about them yourself when adding them to your site.
So for me, if you think it helps you deploying user/server controls you can try. For serving images in general? I would not bother.
Upvotes: 0