If you are coming from MvcSiteMapProvider version 3 you will notice some changes in version 4. One of the key changes in version 4 is using app setting key/values instead of the SiteMap node. To learn more about new features in version 4 click here.
Implementing a visibility provider in version 4 is simple. It requires a couple small steps:
- Creating a class and derive it from “SiteMapNodeVisibilityProviderBase”.
- Add a setting to your web.config file.
- Update the site map file.
Creating our visibility class
Take caution and matchup your namespaces and classes correctly with the sample code I provided. Add a new app setting key/value:
<add key="MvcSiteMapProvider_DefaultSiteMapNodeVisibiltyProvider" value="MyCompany.Web.MyCompanySiteMapVisibilityProvider, MyCompany.Web" />
Making adjustments to sitemap
Finally we are going to make some adjustments to our sitemap file, use the following node as an example, take note of the visibility attribute:
<mvcSiteMapNode title="My Page I want to hide" controller="Home" action="HidePage" visibility="false">
I hope this helps, if you have any questions please contact me on twitter: @tekguy
I love Github and the concept of open source software. I find myself using these projects on a daily basis so I decided to compile a list and share them with you:
- ServiceStack – Super fast .NET web services platform.
- RestSharp – One of the best .NET REST clients.
- Ninject – .NET dependency injector.
- GitIgnore – A compilation of default gitignore files based on frameworks, languages and IDEs
- Twitter Bootstrap – In my opinion the best CSS framework.
Although these project aren’t located on GitHub, they should be mentioned:
- ASP.NET Web Stack – Microsoft decided to open up the .NET framework to the open source community, although you might not contribute to this project, it does offer insight into whats coming in the next version of .NET.
For the past couple days I have reading up on the new specifications for the
<template> tag in HTML 5.1. This new tag allows you to specify a client side template. Although the concept of templates aren’t new its good to see the W3C community coming up with a standard.
In the past to create a “template” you would typically define a div tag with the elements, then you would hide this div by using CSS code
To learn more check out W3C specifications for template.
I am in the process of moving a client’s site from a traditional web hosting platform to azure’s cloud service. The web app uses a sql database that has a file name reference to images in a physical folder on the web server. I need to get these images into an Azure’s blob storage.
To get these images uploaded I decided to use a command line tool called “AzCopy”. You can learn more about the project at: http://blogs.msdn.com/b/windowsazurestorage/archive/2012/12/03/azcopy-uploading-downloading-files-for-windows-azure-blobs.aspx.
The link to download the utility is located on Github.
Here is a sample command:
https://CONTAINER_NAME.blob.core.windows.net/uploads/ /destkey:[AZURE KEY]
I wrote this basic VBScript sample to delete old .bak files from a particular folder if its older than X number of days.