Using Constants in Razor Views

It is very easy when creating a website to fall into the trap of duplicating small bits of information throughout your site.  It may seem expedient to hard-code something like your phone number or email in your views, especially initially when you may only reference it in one or two places. However, once you start […]

Adding Custom Namespaces to Razor Views

I’ve recently been working on a new web site using ASP.net MVC5, and I wanted to be able to reference my view models from my Razor views without having to fully qualify their namespace. Since I keep my view models in their own ViewModels namespace, all I needed to do was add that to the […]

Dynamic Sitemaps in ASP.NET MVC3 (Part 2)

If you aren’t familiar with the schema for a sitemap yet, take a moment to review the basic tags and their definitions.  After you have refreshed your memory, it should be clear that we can use a simple class to represent possible URLs in a sitemap: /// <summary> /// Holds a single url for the […]

Generating a Sitemap in ASP.NET MVC3

Adding a static sitemap to an ASP.NET MVC3 website is very easy. Unfortunately, static sitemaps aren’t nearly as useful as ones that update automatically when new content is added.  To do that, we need a dynamically generated sitemap. Automatically Generated Sitemaps There are a couple of different ways you can generate a sitemap automatically.  A […]