ASP.NET MVC

ASP.NET MVC: An Application Platform

The MVC / WebForms DebateYesterday I wrote about the stored procedure/dynamic sql debate - I must be feeling a bit argumentative lately, because today I was reading Tony Lombardo's post on WebForms versus MVC. I don't know Tony, I haven't read any of his other posts or met him in any forum so I don't hold anything against him. I'd be a hypocrite if I disagreed that you need to weigh the pros/cons and make an informed decision. I just made the same argument myself. However, at the end of his post he said this: “The best advice I've...

ASP.NET MVC: Discover the MasterPageFile Value at Runtime

A couple weeks ago it was finally time to add a context-sensitive, data driven menu system to our MVC application. As I thought about it I was stuck. I wasn't sure what the best way to implement it was. As is common with an MVC application there was no 1-to-1 relationship between actions and views. And even more difficult was that our *.master files could be used by views tied to different controllers. So it was looking like I would have to load the data I needed from the ViewMasterPage. I really didn't like this option and looked around a...

ASP.NET MVC Globalization/Localization: Referencing Resource Files in Your View

I've been using ASP.NET MVC since Preview 1 (Nov 2007). When I need to reference a Resource File (.resx) in my View, I just do the following: 1: <%=Resources.MyResourceFile.MyResourceKey%> Until today, I took that for granted. I received an email this morning referencing this post on ASP.NET. The post was about using Resource Files in an MVC View. I replied to the original post in February 2008 and then forgot about it. Today, I was asked how I got this to work. Since I hadn't ever given it much thought –...

LAMP.NET (Linux Apache Mono.NET PostreSQL)

As an ASP.NET developer I've always worked for companies which had little or no support for any environments other than Windows. But the situation is reversed at my current client. Most development is done in Java or PHP with an Oracle back end. As a Microsoft developer I am in the minority here. The project I am working on is an ASP.NET rewrite of a rare classic ASP application within the organization. During ramp up, we decided that ASP.NET MVC would be a good fit (an a whole lot of fun). The project is going well...

ASP.NET MVC: Compile Your Views for Release Build Only

First of all I have to say I'm excited. Today Scott Guthrie announced the Release Candidate (RC) for ASP.NET MVC is now available. And just yesterday my client signed off on the use of ASP.NET MVC for the project I'm currently ramping up. As I'm reading through the Release Notes and Scott's post, the first thing I wanted to setup was compile checking of my views. The recommendation is to only use this project setting when releasing your build to staging or production because of the time required. I gave it a shot with a brand-new MVC application and the difference...

Using Ajax with ASP.NET MVC

One of the features I continue to wait for from the ASP.NET MVC team is a server control library to work with the MVC framework. So as I have been working on a project using ASP.NET MVC I have begun developing my own library of server controls.Recently, I began looking at the ExtJs library as a client-side script library for my project. I love how extensible the library is and the documentation is very good. However, there seems to be quite a bit of boiler plate code to be written for any data driven controls. So I decided to look...

ASP.NET MVC Error Handling

When working with the latest MVC release (Preview 2) I was having trouble working with the Application_Error event in global.asax. While this does work if you want to redirect to an html file, if you want to redirect to an aspx file you need to use the Controller.OnActionExecuted method. Here's an example: protected override void OnActionExecuted(FilterExecutedContext filterContext) { if (filterContext.Exception != null) { ...

Extend Anonymous Types using Reflection.Emit

I've been playing with the new ASP.NET MVC Framework CTP which uses anonymous types to build url paths which allow you to change the path format. I'm really enjoying the control and the separation of concerns you get.As I've been writing my MVC application I needed to maintain a parameter in all urls for authenticated users but I didn't want to have to manually include the paramter in every url, form action and redirect. So I wrote some extension functions which wrap the Html and Url helper class methods used to build urls (ActionLink, Form and Url). Additionally, I wrote...

 

 

Copyright © Mark J. Miller