Articles : Page 1 of 1
-
Physical Directories vs. MVC View Paths
Apr 1205This post falls into the bucket of operator error on my part, but I want to share this anyway because it describes an issue that has bitten me a few times now and writing it down might keep it a little stronger in my mind. I've been working on an MVC project the last few days, and at the end of a long day I accidentally moved one of my View folders from the MVC Root Folder to the project root. It must have been at the very end of the day before shutting down because tests and manual site nav...
-
Two bugs in ASP.NET MVC 3 and a workaround for both
Jun 1114So I spent an hour today arsing about with a couple of ASP.NET MVC 3 bugs. One was a Routing issue that caused it to act differently to MVC 2. The second I found was a FormsAuthentication issue that insisting on sending me to /Account/Login. Amazing how this crept in really given that it was community tested to death with such a massive ASP.NET MVC following so it is a wonder they weren't weeded out and fixed before RTM. Oh well, don't pretend you don't like a challenge. Routing doesn't work t...
-
How to convert an ASP.NET Web Forms web application into ASP.NET MVC 3
May 1106So, you have a traditional web forms web application and you are inspired by the new ASP.NET MVC 3 are you? Well this is definitely doable. In this how to guide I will tell you step by step exactly how you can add your new ASP.NET MVC 3 work into your existing ASP.NET web forms project. 1. Add referencesRight click on your web root project in Visual Studio (2010 in my case) and add the following references: System.Web.Routing System.Web.Abstractions System.Web.Mvc System.WebPages System.Web...
-
Changing Base Type Of A Razor View
Feb 1121Within a Razor view, you have access to a base set of properties (such as Html, Url, Ajax, etc.) each of which provides methods you can use within the view. For example, in the following view, we use the Html property to access the TextBox method. @Html.TextBox("SomeProperty") Html is a property of type HtmlHelper and there are a large number of useful extension methods that hang off this type, such as TextBox. But where did the Html property come from? It’s a property of System.We...
-
Routing Regression With Two Consecutive Optional Url Parameters
Feb 1120It pains me to say it, but ASP.NET MVC 3 introduces an ugly regression in routing from ASP.NET MVC 2. The good news is that there’s an easy workaround. The bug manifests when you have a route with two consecutive optional URL parameters and you attempt to use the route to generate an URL. The incoming request matching behavior is unchanged and continues to work fine. For example, suppose you have the following route defined: routes.MapRoute("by-day", "archive/{month}/{day}", new { contro...
-
MvcSiteMapProvider 3.0.0 released
Feb 1104Just a quick note to tell that MvcSiteMapProvider 3.0.0 has been released and is available on CodePlex and NuGet. This version is targeted at ASP.NET MVC 3. If you are still using ASP.NET MVC 2, no worries: version 2.3.1 contains the exact same functionality but is targeted at ASP.NET MVC 2. The changelog: Additional UpdatePriority options for generating XML sitemaps Allow to specify target on SiteMapTitleAttribute One action with multiple routes and breadcrumbs Medium Trust optimizatio...
-
Integrating ASP.NET MVC 3 into existing upgraded ASP.NET 4 Web Forms applications
Jan 1106I got an interesting question recently from a gentleman who has an existing ASP.NET WebForms 2.0 application that works just fine. He's upgraded it to ASP.NET 4 and it still works great, but now he wants to add some ASP.NET MVC pages to it. He doesn't want to rewrite the application. A few years ago I did a post on Hybrid ASP.NET applications. The goal was to reinforce the point that you can have ASP.NET applications that are both WebForms and MVC (as well as WCF and ASMX Web Services and o...
-
ASP.NET MVC 3 Preview 1 Released – Channel 9 Video and Hanselminutes Podcast 224, Oh My!
Jul 1027Phil and friends released ASP.NET MVC 3 Preview 1 today. I snuck into the office of Phil Haack and Morgan the Canadian Intern to talk about the release of ASP.NET MVC 3 Preview 1 and some of the cool futures stuff that Morgan (and our fleet of interns) is working on. This video isn't only about MVC as Morgan's working on some cool CSS Sprites stuff that works nicely in WebForms that you should check out as well. Also, my two-hundred-and-twenty-fourth podcast is up and I talk more in depth ...
-
Use Razor as ASP.NET MVC ViewEngine
Jul 1010Since the release of Razor I could not manage time to give a deep dive into this new framework. Last night, I started to explore, the idea was to create ASP.NET MVC View Engine, yes I know the official version is coming up end of this month, but it will give me enough details of the Razor internals in the mean time. Part of the goal was to port the default ASP.NET MVC application in Razor. And here is the basic version: _Master.cshtml <!DOCTYPE html> <head> <title> @RenderSection("title")...
- 1

