0

We have a vs2013-developed-MVC web app that stores validation messages (eg. InvalidUserNameOrPassword=Invalid ID or Password.) in its bin\Resources\Resources.txt file. For eg, when login failed, the view will display "Invalid ID or Password" using: @string.Format(appName.ResourceLibrary.ResourceLocalizer.Current.GetResource("InvalidUserNameOrPassword "), "attchments")

It works fine when deployed to svr1. However, when deployed to svr2, "Resources.txt" cannot be loaded, and the login view cannot obtain the value "Invalid ID or Password" for invalid login. Full controls are granted to "Everyone" at both "bin\Resources" folder and "Resources.txt" file. Does anyone has any idea on what additional setting is require?

Cœur
  • 37,241
  • 25
  • 195
  • 267
user1713584
  • 75
  • 4
  • 8

1 Answers1

0

I don't know why you are following this practice as I consider it as bad practice. Anyway that is not the point here. If you just want to user resources for showing messages you should go with Global Resources.

For your ease please refer to below links to implement it in your project:

Best Practice for Asp.net MVC Resource Files

In above link refer to accepted answer.

Benefits:

  1. You can access it anywhere in your project just by adding namespace.
  2. You don't need to read text file (Performance gain)
  3. Easy syntax.
  4. More readable
  5. More maintainable
  6. No permission mess

Let me know if you face any trouble in this implementation. Hope this will help you.

Community
  • 1
  • 1
Priyank Sheth
  • 2,352
  • 19
  • 32