views:

130

answers:

4

Hello,

I am looking for a method of storing Application Messages, such as

  • "You have logged in successfully"
  • "An error has occurred, please call the helpdesk on x100"
  • "You do not have the authority to reset all system passwords" etc

So that "when" the users decide they don't like the wording of messages I don't have to change the source cdoe, recompile then redeploy - instead I just change the message store.

I really like the way that I can easily access strings in the web.config using keys and values.

ConfigurationManager.AppSettings("LOGINSUCCESS")

However as I could have a large number of application messages I didn't want to use the web.config directly. I was going to add a 2nd web config file and use that but of course you can only have one per virtual directory.

Does anyone have any suggestions on how to do this without writing much custom code?

Thanks

+3  A: 
  • Put the strings in an xml file and use a filewatcher to check for updates to the file
  • Put the strings in a database, cache them and set a reasonable expiration policy
Tundey
+6  A: 

In your Web.config, under appSettings, change it to:

<appSettings file="StringKeys.config">

Then, create your StringKeys.config file and have all your keys in it.

You can still use the AppSettings area in the main web.config for any real application related keys.

FlySwat
A: 

You can use ResourceManager class. See "ResourceManager and ASP.NET" article at http://msdn.microsoft.com/en-us/library/aa309419(VS.71).aspx

aku
+1  A: 

I'm not a 15 yet :(, but I tried to bump Tundey's response.

kenny