user808128
user808128

Reputation: 521

Can ASP.NET MVC SiteMap provider use arbitrary resources?

At this page the author wrote that the resources must be in special application folder (App_GlobalResources). OK, I put them in it. But in my project I use a tree of resource folders which reflects the tree of my views/models/etc. folders. So in each terminal folder of my tree branches I have a file with the same name (like "Strings" or any) as other resource files. This scheme seems easy to maintain resources corresponds to relative project file. All like this:

Application folders tree:

Views
-Account
--LogOn.cshtml
-Home
--Index.cshtml

Resources folders tree:

Resources
-Views
--Account
---LogOn
----Locals
-----Strings.resx // the same name
--Home
---Index
----Locals
-----Strings.resx // the same name

But this sameness within names leads to error of resources conflict in the App_GlobalResources folder. Even if I assign different namespaces for each resource file.

If I use my scheme out of App_GlobalResources, all works fine with resources but MvcSiteMapProvider.

So, can MvcSiteMapProvider use another resource folder except App_GlobalResources? Or how can I organize my resources to make them works with MvcSiteMapProvider properly but to avoid complication with huge resource amount.

Upvotes: 1

Views: 761

Answers (1)

Tomaz Tekavec
Tomaz Tekavec

Reputation: 764

There are some advantages if you put your resource files outside the App_GlobalResources folder. Scott Allen wrote an excellent article about it:

http://odetocode.com/Blogs/scott/archive/2009/07/16/resource-files-and-asp-net-mvc-projects.aspx

You can use resources from another assembly within MvcSiteMapProvider, but you have to write your own resource provider, as explained here:

http://msdn.microsoft.com/en-us/library/aa905797.aspx

www.c-sharpcorner.com/uploadfile/prvn_131971/chapter-i-resources-and-localization/

Upvotes: 1

Related Questions