Site navigation the Microsoft way

MS Navigation

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

I really used the stuffing out of that link this week.  I was focusing on the sitemap functionality that MS built into asp.net.  The documentation was a pain to use though – because the document references multiple concepts, you have to follow all these links to read up on all the parts.  So this is how I worked through the document: I read through one time and following every link I came across (this left me a little confused).  Then I scanned it a second time and clicked on the links for items I couldn’t remember.  Then I created a test project and used the document as a reference.  Then I went home because I had enough.  The next day I carefully read through the document again – this was most helpful and kind of solidified everything.

All in all I kind of liked the site navigation.  The ability to reference the site navigation object anywhere is rather nice.  I made one modification though – I now throw a 403 error if a user tries to reference anything not in their site map thusly:

private void ValidateAccess() {     if (!(IsCurrentPageUnrestricted() || CurrentUser.SiteMap().CurrentNode != null)) throw new HttpException(403, "You do not have permission to access: " + Page.Request.AppRelativeCurrentExecutionFilePath.ToLower()); }

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s