Tag: mvc
-
TempData not cleared between requests when using ContainsKey
Recently I was trying to add a simple message to the top of the screen if the user had been logged out. This message, should appear only once. If the user navigates away from the page, it shouldn’t show again. So, it made sense to use TempData In my controller, I had something like this:…
-
Dynamic routes with ASP.net MVC – Category/Location mapping to controller
I’ve recently been looking in to building a directory type application with Asp.Net MVC One of the requirements would be to have SEO friendly URLs such as: http://www.mysite.com/restaurants/Camberley—Surrey /restaurants being the “Category” /Camberley—Surrey being the “Location” So, I created a ‘CategoryController’ like this public class CategoryController : Controller { public ActionResult Index(string category, string location)…