tags:

views:

407

answers:

1

I'm using standard ASP.NET and a Web.sitemap file which describes the navigation structure of the site. Now, I want to use my resourceKey attribute as a page identifier in my code, so I can perform eg. authorization checks and similar.

Problem is it's always null, for example when retrieving SiteMap.CurrentNode.ResourceKey

I have tried to set enableLocalization="true" in the Web.sitemap, and <siteMap enable="true" /> in Web.config but that doesn't help.

Any advice?

Thanks, Jacob

+1  A: 

Found the solution myself: It's necessary to create a .resx file for the sitemap in App_GlobalResources before one can access the resource keys.

IMO this is not 100% logical, but ResourceKeys are not supposed to be used for other things than localizing, once could argue.

JacobE
but the Resource key is the property of siteampnode, It should be accessble without adding .resx file??
Muhammad Akhtar
It is accessible, but apparently you cannot read the value from the .Sitemap file unless you have a resource file too
JacobE
+1 for saving me hours of head scratching - nice catch!
Marc