JacobE
JacobE

Reputation: 8141

ASP.NET Sitemap .ResourceKey property is null

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

Upvotes: 1

Views: 1890

Answers (1)

JacobE
JacobE

Reputation: 8141

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.

Upvotes: 2

Related Questions