Best practice - resources in ASP.Net Web Applications

  • Thread starter Peter Larsen [CPH]
  • Start date

Peter Larsen [CPH]


I'm looking for some "best practice" help related to web applications and
recources (images, strings, files etc).

In Windows Forms Applications its normal to save all kinds of resources in
the applications recource file - its easy to access, and you always knows
where the resources are (and more).

In web applications, you would normally have lots of icons, buttons etc. for
use in the pages.
Where would you put these resources - in the recource file ??

Thank you in advance.


bruce barker

for packaged components its handy to use resources for images,
stylesheets, etc. But for a website its a bad idea. the performance is
much lower and chaching may be effected. its common to have a common
image dir that is shared between websites (so the image is cached
between all).

-- bruce (

Peter Larsen [CPH]

Hi Bruce,

Yes it is slow to read images from the resource file - good point.
In winforms, i usually loads the resources into memory and keeps them there
as long as they are visible. But for webapplications, that works

Thanks for your comment.

Peter Larsen [CPH]

Hi Sloan,

Thanks for the links.
GetWebResourceUrl() seems to be the answer - i will definitely read more
about that way to do it.


Steven Cheng [MSFT]

Hi Peter,

For ASP.NET (start from 2.0), it also provide very rich support on
localization/globalization functionality. Generally there are two ways to
use localized resources:

1. Declarative approach via attribute and localize expression in aspx
template, you can bind resource in resource file to control property

2. Use code to programmtically load resource(global or local page resource).

here are some further good resource on ASP.NET globalization & localization:

#Internationalizing Your Application

#ASP.NET 2.0 Localization (Video, Whitepaper, and Database Provider

#Extending the ASP.NET 2.0 Localization Model with a Database Resource


Steven Cheng

Microsoft MSDN Online Support Lead

Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
(e-mail address removed).

Get notification to my posts through email? Please refer to

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
This posting is provided "AS IS" with no warranties, and confers no rights.

From: "Peter Larsen [CPH]" <[email protected]>
References: <[email protected]>

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question