ASP.NET MVC Preview 4 Release (Part 1)

The ASP.NET MVC team is in the final stages of finishing up a new "Preview 4" release that they hope to ship later this week.  The Preview 3 release focused on finishing up a lot of the underlying core APIs and extensibility points in ASP.NET MVC.  Starting with Preview 4 this week you'll start to see more and more higher level features begin to appear that build on top of the core foundation and add nice productivity.

There are a bunch of new features and capabilities in this new build - so much in fact that I decided I needed two posts to cover them all.  This first post will cover the new Caching, Error Handling and Security features in Preview 4, as well as some testing improvements it brings.  My next post will cover the new AJAX features being added with this release as well.

Understanding Filter Interceptors

Action Filter Attributes are a useful extensibility capability in ASP.NET MVC that was first added with the "Preview 2" release.  These enable you to inject code interceptors into the request of a MVC controller that can execute before and after a Controller or its Action methods execute.  This enables some nice encapsulation scenarios where you can easily package-up and re-use functionality in a clean declarative way.

Below is an example of a super simple "ScottGuLog" filter that I could use to log details about exceptions raised during the execution of a request.  Implementing a custom filter class is easy - just subclass the "ActionFilterAttribute" type and override the appropriate methods to run code before or after an Action method on the Controller is invoked, and/or before or after an ActionResult is processed into a response.

Using a filter within a ASP.NET MVC Controller is easy - just declare it as an attribute on an Action method, or alternatively on the Controller class itself (in which case it will apply to all Action methods within the Controller):

Above you can see an example of two filters being applied.  I've indicated that I want my "ScottGuLog" to be applied to the "About" action method, and that I want the "HandleError" filter to be applied to all Action methods on the HomeController.

Previous preview releases of ASP.NET MVC enabled this filter extensibility, but didn't ship with pre-built filters.  ASP.NET Preview 4 now includes several useful filters for handling output caching, error handling and security scenarios.

OutputCache Filter

The [OutputCache] filter provides an easy way to integrate ASP.NET MVC with the output caching features of ASP.NET (with ASP.NET MVC Preview 3 you had to write code to achieve this). 

To try this out, modify the "Message" value set within the "Index" action method of the HomeController (created by the VS ASP.NET MVC project template) to display the current time:

When you run your application you'll see that a timestamp updates each time you refresh the page:

We can enable output caching for this URL by adding the [OutputCache] attribute to the our Action method.  We'll configure it to cache the response for a 10 second duration using the declaration below:

Now when you hit refresh on the page you'll see that the timestamp only updates every 10 seconds.  This is because the action method is only being called once every 10 seconds - all requests between those time intervals are served out of the ASP.NET output cache (meaning no code needs to run - which makes it super fast).

In addition to supporting time duration, the OutputCache attribute also supports the standard ASP.NET output cache vary options (vary by params, headers, content encoding, and custom logic).  For example, the sample below would save different cached versions of the page depending on the value of an optional "PageIndex" QueryString parameter, and automatically render the correct version depending on the incoming URL's querystring value:

You can also integrate with the ASP.NET Database Cache Invalidation feature - which allows you to automatically invalidate the cache when a database the URL depends on is modified (tip: the best way to-do this is to setup a CacheProfile section in your web.config and then point to it in the OutputCache attribute). 

HandleError Filter

The [HandleError] filter provides a way to declaratively indicate on a Controller or Action method that a friendly error response should be displayed if an error occurs during the processing of a ASP.NET MVC request. 

To try this out, add a new "TestController" to a project and implement an action method that raise an exception like below:

By default when you point your browser at this URL, it will display a default ASP.NET error page to remote users (unless you've gone in and configured a <customErrors> section in your web.config file):

We can change the HTML error displayed to be a more friendly end-user message by adding a [HandleError] attribute to either our Controller or to an Action method on our Controller:

The HandleError filter will catch all exceptions (including errors raised when processing View templates), and display a custom Error view response when they occur.  By default it attempts to resolve a View template in your project called "Error" to generate the response.  You can place the "Error" view either in the same directory as your other Controller specific views (for example: \Views\Test for the TestController above), or within the \Views\Shared folder (it will look first for a controller specific error view, and then if it doesn't find one it will look in the shared folder - which contains views that are shared across all controllers).

Visual Studio now automatically adds a default "Error" view template for you inside the \Views\Shared folder when you create new ASP.NET MVC Projects starting with Preview 4:

When we add a [HandleError] attribute to our TestController, this will by default show remote users an html error page like below (note that it picks up the master page template from the project so that the error message is integrated into the site).  You can obviously go in and customize the Error view template to display whatever HTML and/or friendlier customer error message you want - below is simply what you get out of the box:

To help developers, the default Error view template provided by the new project template in Visual Studio is written to display additional error stack trace information when you are browsing the application locally:

You can turn this off either by deleting the code from the Error view template, or by setting <customErrors> to "off" inside your web.config file.

By default the [HandleError] filter will catch and handle all exceptions that get raised during the request.  You can alternatively specify specific exception types you are interested in catching, and specify custom error views for them by specifying the "ExceptionType" and "View" properties on [HandleError] attributes:

In the code above I'm choosing to display custom error views for SqlExceptions and NullReferenceExceptions.  All other exceptions will then use the default "Error" view template.

Authorize Filter

The [Authorize] filter provides a way to declaratively control security access on a Controller or Action method.  It allows you to indicate that a user must be logged in, and optionally require that they are a specific user or in a specific security role in order to gain access.  The filter works with all types of authentication (including Windows as well as Forms based authentication), and provides support for automatically redirecting anonymous users to a login form as needed.

To try this out, add an [Authorize] filter to the "About" action in the HomeController created by default with Visual Studio:

Declaring an [Authorize] attribute like above indicates that a user must be logged into the site in order for them to request the "About" action.  When non-logged-in users attempt to hit the /Home/About URL, they will be blocked from gaining access.  If the web application is configured to use Windows based authentication, ASP.NET will automatically authenticate the user using their Windows login identity, and if successful allow them to proceed.  If the web application is configured to use Forms based authentication, the [Authorize] attribute will automatically redirect the user to a login page in order to authenticate (after which they'll have access):

The [Authorize] attribute optionally allows you to grant access only to specific users and/or roles.  For example, if I wanted to limit access to the "About" action to just myself and Bill Gates I could write:

Typically for all but trivial applications you don't want to hard-code user names within your code.  Instead you usually want to use a higher-level concept like "roles" to define permissions, and then map users into roles separately (for example: using active directory or a database to store the mappings).  The [Authorize] attribute makes it easy to control access to Controllers and Actions using a "Roles" property:

The [Authorize] attribute does not have a dependency on any specific user identity or role management mechanism.  Instead it works against the ASP.NET "User" object - which is extensible and allows any identity system to be used.

AccountController Class

I mentioned above that the [Authorize] attribute can be used with any authentication or user identity management system.  You can write or use any custom login UI and/or username/password management system you want with it.

To help you get started, though, the ASP.NET MVC Project Template in Visual Studio now includes a pre-built "AccountController" and associated login views that implement a forms-authentication membership system with support for logging in, logging out, registering new users, and changing passwords.  All of the views templates and UI can be easily customized independent of the AccountController class or implementation:

The Site.master template also now includes UI at the top-right that provides login/logout functionality.  When using forms-based authentication it will prompt you to login if you are not currently authenticated:

And it displays a welcome message along with a logout link if you are authenticated on the site:

Clicking the Login link above takes users to a Login screen like below that they can use to authenticate:

New users can click the register link to create new accounts:

Error handing and error display is also built-in:

The AccountController class that is added to new projects uses the built-in ASP.NET Membership API to store and manage user credentials (the Membership system uses a provider API allowing any back-end storage to be plugged-in, and ASP.NET includes built-in providers for Active Directory and SQL Server).  If you don't want to use the built-in Membership system you can keep the same AccountController action method signatures, View templates, and Forms Authentication ticket logic, and just replace the user account logic within the AccountController class.  For the next ASP.NET MVC preview release we are planning to encapsulate the interaction logic between the AccountController and the user identity system behind an interface - which will make it easier to plug-in your own user storage system (without having to implement a full membership provider) as well as to easily unit test both it and the AccountController.

Our hope is that this provides a nice way for people to quickly get started, and enable them to have a working end to end security system as soon as they create a new project.

Testing TempData

One last improvement to touch on in this first preview 4 post is some improvements being made on the Controller class that allow you to more easily unit test the TempData collection.  The TempData property allows you to store data that you want to persist for a future request from a user.  It has the semantic of only lasting one future request (after which it is removed).  It is typically used for MVC scenarios where you want to perform a client-side redirect to change the URL in the browser, and want a simple way to store scratch data.

With previous ASP.NET MVC Previews you had to mock objects in order to test the TempData collection.  With Preview 4 you no longer need to mock or setup anything.  You can now add and verify objects within the Controller's TempData collection directly within your unit tests (for example: populate a controller's TempData property before calling its action method, or verify that the action updated the TempData after the action returned).  The actual storage semantics of the TempData collection is now encapsulated within a separate TempDataProvider property. 

Conclusion

Hopefully the above post provides a quick look at a number of the new features and changes coming with ASP.NET MVC Preview 4.  My next post on ASP.NET MVC Preview 4 will cover the new AJAX functionality that has been added, and demonstrate how to take advantage of it.

Hope this helps,

Scott

Published Monday, July 14, 2008 2:18 AM by ScottGu
Filed under: , , ,

Comments

# re: ASP.NET MVC Preview 4 Release (Part 1)

Monday, July 14, 2008 5:28 AM by Lee Englestone

Filter interceptors look cool! I only wish my Hosting Provider would install .NET 3.5!

I have pleaded with no success! Perhaps you could have a word with them? lol

Good work.

-- Lee

# re: ASP.NET MVC Preview 4 Release (Part 1)

Monday, July 14, 2008 5:29 AM by conannb

Awesome!

# re: ASP.NET MVC Preview 4 Release (Part 1)

Monday, July 14, 2008 5:32 AM by shiju

Hi Scott,

Great. When will release the Preview 4?

# re: ASP.NET MVC Preview 4 Release (Part 1)

Monday, July 14, 2008 5:35 AM by Maarten Balliauw

Very nice to see some community concepts like the MvcMembership starter kit (www.codeplex.com/MvcMembership) and my outputcache attribute filter (blog.maartenballiauw.be/.../Extending-ASPNET-MVC-OutputCache-ActionFilterAttribute-Adding-substitution.aspx) being incorporated. Thanks for the ongoing effort to demands of the community! Thumbs up!

# re: ASP.NET MVC Preview 4 Release (Part 1)

Monday, July 14, 2008 5:37 AM by Richard Chamorro

Great work!

We were waiting for the Ajax support to begin our first project using ASP.NET MVC. I'm looking forward to read your next article.

Regards,

Richard

# re: ASP.NET MVC Preview 4 Release (Part 1)

Monday, July 14, 2008 5:39 AM by Fredrik James

Hi Scott,

Are you going to write a separate blog for  " Dynamic languages support in Asp.Net MVC preview 4 "

I understand, you had mentioned in your old blog about the said support with preview 4.

I hope this comes true with Preview 4.

Thanks

Fredrik

# About ASP.NET MVC Preview 4

Monday, July 14, 2008 5:40 AM by Shawn Chi

ASP.NET MVC Preview 4 Release (Part 1)

# re: ASP.NET MVC Preview 4 Release (Part 1)

Monday, July 14, 2008 5:47 AM by Christian

Hi Scott thanks for the new beta and this preview

im glad that ado.net and better linq support is added. Is there any way or chance that Silverlight will support MDX directly? ( no not webservice )

# ASP.NET MVC preview release 4 - part 1

Monday, July 14, 2008 5:49 AM by DotNetKicks.com

You've been kicked (a good thing) - Trackback from DotNetKicks.com

# re: ASP.NET MVC Preview 4 Release (Part 1)

Monday, July 14, 2008 6:06 AM by kamii47

Looks Cool,

Let see what we have for this weekend.

# re: ASP.NET MVC Preview 4 Release (Part 1)

Monday, July 14, 2008 6:08 AM by Simone

Hi Scott,

great news... less the 2 months since the previous drop... keep up the good work.

Just one question: does this version already include something to enable 3rd party components (components with both view and controllers shipped in a separate assembly?

Simo

# re: ASP.NET MVC Preview 4 Release (Part 1)

Monday, July 14, 2008 6:09 AM by lzanca

Any plan to integration/interaction between Authorize Filter, the AccountController and the "Zermatt" new itentity application development framwwork?

Thanks

Luca

# re: ASP.NET MVC Preview 4 Release (Part 1)

Monday, July 14, 2008 6:14 AM by Bekenov Azamat

Great news!

Big thanks to asp.net mvc team.

# re: ASP.NET MVC Preview 4 Release (Part 1)

Monday, July 14, 2008 6:24 AM by Scooby

Hi Scott,

this is great - nice work!

I (still) wonder about sub-controllers - will they be in the Preview 4 or when can we expect this most valuable feature?

In my opinion it's the last missing piece to really get started on MVC.

THX,

Scooby

# re: ASP.NET MVC Preview 4 Release (Part 1)

Monday, July 14, 2008 6:44 AM by Mike

Looks good! I use TempData in regular web forms, and I think that System.Web.UI.Page and controls as well should have access to the TempData. It's tool late for 3.5 SP1, but would you consider putting it on the list for the next version of ASP.NET?

Thanks!

# re: ASP.NET MVC Preview 4 Release (Part 1)

Monday, July 14, 2008 6:50 AM by Peter Short

Hi Scott, love the blog, always a great read! One slightly (read completely) off topic question, what theme are you using for VS? It looks fantastic!

# re: ASP.NET MVC Preview 4 Release (Part 1)

Monday, July 14, 2008 6:51 AM by aL

sounds great :)

awsome stuff as always scott:)

/allan

# MVC Preview 4

Monday, July 14, 2008 7:04 AM by Melvyn Harbour

It's been announced on ScottGu's blog that MVC Preview 4 is due out later this week. Obviously we'll

# re: ASP.NET MVC Preview 4 Release (Part 1)

Monday, July 14, 2008 7:13 AM by Shiny Zhu

That is pretty good about the cache, and the account managements.

# re: ASP.NET MVC Preview 4 Release (Part 1)

Monday, July 14, 2008 7:27 AM by vik20000in

after a long time a post from you....

# re: ASP.NET MVC Preview 4 Release (Part 1)

Monday, July 14, 2008 7:36 AM by Emad Ibrahim

can't wait to upgrade www.yonkly.com to P4.  Thanks.

# ScottGu on the upcoming Preview 4 of MS MVC : { null != Steve }

Pingback from  ScottGu on the upcoming Preview 4 of MS MVC :  { null != Steve }

# re: ASP.NET MVC Preview 4 Release (Part 1)

Monday, July 14, 2008 8:18 AM by HeartattacK

Yippee...scott's alive :):)

I guess he was just busy making this awesome post...

# Visual Studio Links #51

Monday, July 14, 2008 8:19 AM by Visual Studio Hacks

My latest in a series of the weekly, or more often, summary of interesting links I come across related to Visual Studio. Visual Studio 2008 KB: Also applied to 2005. The Visual Studio Designer does not Respect Assembly Binding Redirection. No current

# re: ASP.NET MVC Preview 4 Release (Part 1)

Monday, July 14, 2008 8:30 AM by Swapna Gupta

Can you please give some date as to when will the ASP.Net MVC go live?

Thanks.

- Swapna

# re: ASP.NET MVC Preview 4 Release (Part 1)

Monday, July 14, 2008 8:47 AM by Dominic Pettifer

Please tell me Form Validation controls are in this release, please!!

# ASP.NET MVC Archived Blog Posts, Page 1

Monday, July 14, 2008 8:49 AM by ASP.NET MVC Archived Blog Posts, Page 1

Pingback from  ASP.NET MVC Archived Blog Posts, Page 1

# re: ASP.NET MVC Preview 4 Release (Part 1)

Monday, July 14, 2008 8:50 AM by Jahedur Rahman

Wow! Amazing. Waiting for the release. Thanks Scott.

# re: ASP.NET MVC Preview 4 Release (Part 1)

Monday, July 14, 2008 8:51 AM by Ronnie Hoogland

Hi Scott,

I'm glad that I haven't put a lot of work in my current MVC application regarding authentication/authorisation. This saves me a lot work. tnx

Can you also give us a general overview of things to come (after preview 4)? Or delegate it to someone else and share the link :)

tia

# re: ASP.NET MVC Preview 4 Release (Part 1)

Monday, July 14, 2008 8:59 AM by Webdiyer

Haven't seen you for a very very long time, miss you much....:) thanks for your team's great work!

# re: ASP.NET MVC Preview 4 Release (Part 1)

Monday, July 14, 2008 9:08 AM by Tom

Damn, if I just waited one day with starting to implement my security controller, its the exact same thing, also made with attribute filters based on a blogpost by Phil Haack, pretty sure he wrote this part then :P.

Great work!

ps. Is it allowed to run the mvc framework on mono? I thought someone wrote that it was not allowed.

# ASP.NET MVC Refresh 4

Monday, July 14, 2008 9:14 AM by StrangeLog - Il blog di Andrea Saltarello

ASP.NET MVC Refresh 4

# re: ASP.NET MVC Preview 4 Release (Part 1)

Monday, July 14, 2008 9:23 AM by robi

Hello, What do I need in order to use the new AccountController against Windows authentication.

Thanks, Robi

# re: ASP.NET MVC Preview 4 Release (Part 1)

Monday, July 14, 2008 9:41 AM by Joe Young

Scott,

I noticed your controller action methods are returning generic objects and not ActionResults. Is this the new preferred way of declaring controller actions? Are ActionResult objects still used?

# re: ASP.NET MVC Preview 4 Release (Part 1)

Monday, July 14, 2008 9:43 AM by Marco von Frieling

Hi Scott!

Good work, I'm waiting for your second post on Preview 4.

Filters are really cool, but it would be nice to plug-in filters globally on all controllers (e. g. the HandleError or the ScottGuLog filter).

What about Ajax support for JQuery?

Thanks.

# re: ASP.NET MVC Preview 4 Release (Part 1)

Monday, July 14, 2008 9:44 AM by JProgrammer

I really impresive with preview4, i just waiting release :)

# Daily Find #89 | TechToolBlog

Monday, July 14, 2008 9:46 AM by Daily Find #89 | TechToolBlog

Pingback from  Daily Find #89 | TechToolBlog

# re: ASP.NET MVC Preview 4 Release (Part 1)

Monday, July 14, 2008 9:49 AM by pure.krome

<3 to the ASP.NET MVC team!

Interesting to see what the next post is about, re: Ajax .. because i currently use jQuery for all my Ajax and it's brilliant, light and fast (thanks to ASP.NET MVC). I wonder if Guru Gu was meaning 'ASP.NET Ajax' instead.. ? prolly ;)

# re: ASP.NET MVC Preview 4 Release (Part 1)

Monday, July 14, 2008 10:05 AM by VB

Wow!! I've been looking forward to have Ajax support with MVC.

The Authorize filter sounds more like declarative security, how much of it is extensible?

Also will this preview have a complete support with Dynamic Data?

# re: ASP.NET MVC Preview 4 Release (Part 1)

Monday, July 14, 2008 10:07 AM by HB

That exception handing attribute is beautiful... I had a tear come to my eye just reading it!

# re: ASP.NET MVC Preview 4 Release (Part 1)

Monday, July 14, 2008 10:12 AM by subdigital

Looking good, I like all the new changes.

I haven't seen any love for ComponentController recently.  Is something different in the works?

# re: ASP.NET MVC Preview 4 Release (Part 1)

Monday, July 14, 2008 10:24 AM by Steve

Scott, good to hear from you, it's been a while :)

Now that we are on Preview 4, what comes next? Beta 1?  RC1?

# re: ASP.NET MVC Preview 4 Release (Part 1)

Monday, July 14, 2008 10:32 AM by Zsolt Juhasz

Hi there, does anyone know where I can get/download the vssettings file coresponding the screenshots in this post? I find it really relaxing to read it instead of my current default Visual Studio Setting (Bright background with dark fonts)

Thanks

# re: ASP.NET MVC Preview 4 Release (Part 1)

Monday, July 14, 2008 10:32 AM by Tony

The link to the pictures and examples are broken.

# re: ASP.NET MVC Preview 4 Release (Part 1)

Monday, July 14, 2008 10:42 AM by Joe Gray

Will the objects in TempData now be serialized so that using SQL session state will be easier?

# re: ASP.NET MVC Preview 4 Release (Part 1)

Monday, July 14, 2008 10:49 AM by Rafael Rosa

Nice job with Preview 3, and Preview 4 seems to be quite good too. I'm glad that the new security features aren't tied-up to any specific authentication/authorization system, and hope the new AJAX stuff will work the same way. Keep up the good work :)

Cheers from Brazil,

Rafael Rosa.

# re: ASP.NET MVC Preview 4 Release (Part 1)

Monday, July 14, 2008 10:52 AM by omeganot

Very nice.  The interceptor concept is a great idea, and looks nice and easy to implement.

P.S.  Welcome back!  Haven't seen an update to your blog for over a month.  We'll have to call off the search and rescue parties!

# re: ASP.NET MVC Preview 4 Release (Part 1)

Monday, July 14, 2008 11:06 AM by Glenn Kees

I am really happy to see the support added for authentication and authorization (two critical components to secured applications).  Also, I wanted to say how impressed I have been with the rapid turnaround on these preview releases.  Keep up the incredible work!

# ASP.NET MVC Preview 4 Release(暂放首页)

Monday, July 14, 2008 11:26 AM by Q.Lee.lulu

刚才太阳告诉我的,很兴奋的跑去看了,发现没有很多令我兴奋的东西。主要的新特性有Caching,ErrorHandlingandSecurity。这些都是

# re: ASP.NET MVC Preview 4 Release (Part 1)

Monday, July 14, 2008 11:27 AM by sftdev

Awesome!!! I can't wait for ASP.NET MVC preview 4 to drop!!!

# re: ASP.NET MVC Preview 4 Release (Part 1)

Monday, July 14, 2008 11:35 AM by Will 保哥

Previw 4 is excellent!  I can't wait for it.

# re: ASP.NET MVC Preview 4 Release (Part 1)

Monday, July 14, 2008 11:55 AM by .netCoder

It's realy great! Waiting for the release.

# re: ASP.NET MVC Preview 4 Release (Part 1)

Monday, July 14, 2008 12:22 PM by dinoboy

To Zsolt Juhasz:

I found Scotts settings file from comments of his earlier post about unit testing and silverlight. Here is the link

www.scottgu.com/.../vssettings.zip

Hope this helps

# re: ASP.NET MVC Preview 4 Release (Part 1)

Monday, July 14, 2008 12:34 PM by Will Shaver

Where's the props to the mvccontrib project? ;-)

Glad to see it moving forward.

# ASP .NET MVC Preview 4 już w tym tygodniu

Monday, July 14, 2008 12:55 PM by Bartek Szafko

Na blogu Scotta Guthrie ukazała się notatka, że już w tym tygodniu można spodziewać się następnej wersji

# re: ASP.NET MVC Preview 4 Release (Part 1)

Monday, July 14, 2008 12:57 PM by Al Katawazi

Wow I wish I saw this blog last week, I just wrote an entire security controller myself using ASP.Net Membership API along with all the views. Thanks for the update though, I'm sure your stuff is going to be a lot less buggy then my controller.

# re: ASP.NET MVC Preview 4 Release (Part 1)

Monday, July 14, 2008 1:53 PM by Elijah Manor

That is great! I look forward to integrating my app w/ the new preview. I noticed a validator message. Will that be done directly against the model with property attributes?

# re: ASP.NET MVC Preview 4 Release (Part 1)

Monday, July 14, 2008 2:32 PM by HJP

ASP.NET MVC really rock! Can you all feel the wind of change? Great times are coming!

# re: ASP.NET MVC Preview 4 Release (Part 1)

Monday, July 14, 2008 3:14 PM by Mike

You're changed ActionResult to Object, is that to support DLR-languages better?

# re: ASP.NET MVC Preview 4 Release (Part 1)

Monday, July 14, 2008 3:26 PM by ScottGu

Hi Mike,

>>>>>> You're changed ActionResult to Object, is that to support DLR-languages better?

It turns out you can do this with Preview 3 as well.  I just aesthetically prefer object over ActionResult for some reason (although one of the reasons this was supported was for DLR languages). :-)

Hope this helps,

Scott

# re: ASP.NET MVC Preview 4 Release (Part 1)

Monday, July 14, 2008 3:28 PM by ScottGu

Hi Elijah,

>>>>>>> That is great! I look forward to integrating my app w/ the new preview. I noticed a validator message. Will that be done directly against the model with property attributes?

Validation and forms error state management support isn't in Preview 4 unfortunately (it just missed the date).  The good news is that it will be in the next preview (and it will support validating against model objects).  The login views will be updated to use that once that support is in.

Hope this helps,

Scott  

# re: ASP.NET MVC Preview 4 Release (Part 1)

Monday, July 14, 2008 3:29 PM by ScottGu

Hi Fredrik,

>>>>>>> Are you going to write a separate blog for  " Dynamic languages support in Asp.Net MVC preview 4 "

Good question - I need to figure out if someone already has a blog post planned to cover this.  I know the DLR team has been showing IronRuby and IronPython support using ASP.NET MVC at conferences recently - and I believe that will work with Preview 4 (but am not 100% sure).  I will try and find out and get someone to post about this.

Thanks,

Scott

# More ASP.NET MVC goodness

Monday, July 14, 2008 4:12 PM by Ross Hawkins

More ASP.NET MVC goodness

# re: ASP.NET MVC Preview 4 Release (Part 1)

Monday, July 14, 2008 4:35 PM by Tim Hardy

I'd prefer if the team were to focus on the getting the framework released more than working on completely separate products, like AJAX.  AJAX has nothing to do with the workings of MVC.  One of the wonderful things about what you guys have accomplished with MVC is that you've written a framework that is truly client-framework agnostic.  I can use prototype/scriptaculous, mootools, jquery, etc just beautifully with ASP.NET MVC.  I'm using Prototype currently, and loving it.

With all the free, incredibly mature AJAX products out there on the market currently, I honestly see this as a waste of time, since there are so many of us waiting for MVC to reach a production release.  Get MVC production ready, then work on the independent frameworks that MVC can interact with - please.  It seems like you're spending time arguing over paint colors when the wheels haven't been attached to the car yet.  

Don't get me wrong, I'm incredibly excited about what you're doing, it just appears from your feature selection that you don't realize how important it is for your audience that the core engine of this framework be released as soon as possible.  There are plenty of AJAX frameworks in existence to see how MVC plays with them without having to divert your workforce to make their own or to add sugar to an AJAX framework many of us may never use.

# re: ASP.NET MVC Preview 4 Release (Part 1)

Monday, July 14, 2008 4:43 PM by Orion2480

Nice to see the testability of TempData.  Are there any plans to support testing through the entire stack - Model (check!), Controller (check!), View .... ?

I would find it to be wonderful to be able to check the actual view output in order to:

A) Ensure our view code doesn't cause problems (since compile time checks don't always work

B) Validate the XHTML output of the response

It would be awesome to build the suite of tests so that when I make a change, I can run them and make sure nothing else broke as a result, including bad code templates and XHTML validity.

# re: ASP.NET MVC Preview 4 Release (Part 1)

Monday, July 14, 2008 4:46 PM by Jørn Schou-Rode

Zsolt Juhasz: Scott Hanselman has a nice collection of VS themes, including a dark gray theme which seems to be the same or close to what ScottGu uses.

www.hanselman.com/.../VisualStudioProgrammerThemesGallery.aspx

# Retour au bercail ! | The .Net frog

Monday, July 14, 2008 4:50 PM by Retour au bercail ! | The .Net frog

Pingback from  Retour au bercail ! | The .Net frog

# ASP.NET MVC - Preview 4 kommt demn&auml;chst | Code-Inside Blog

Pingback from  ASP.NET MVC - Preview 4 kommt demn&auml;chst | Code-Inside Blog

# re: ASP.NET MVC Preview 4 Release (Part 1)

Monday, July 14, 2008 5:15 PM by Robert

Great work - Is in the Preview 4 a new concept for the "ComponentControllers"? Are there any plans to support the "Controls-Guys" like Telerik ("just drop this dll in your project and it works")?

# re: ASP.NET MVC Preview 4 Release (Part 1)

Monday, July 14, 2008 5:24 PM by Lamin Barrow

WOW.... Thanks for the news Scoyt. I can't wait to lay my hands on preview 4.

# re: ASP.NET MVC Preview 4 Release (Part 1)

Monday, July 14, 2008 6:52 PM by Dave Parslow

From the screen shot of the AccountController Class, it shows some membership (i.e. account) views but what about some of the other views that the MvcMembership starter kit (www.codeplex.com/MvcMembership) provides?

Such as:

* List of Registered Users

* User Details / Administration

* Role Management

# re: ASP.NET MVC Preview 4 Release (Part 1)

Monday, July 14, 2008 6:53 PM by Suresh

Do we know the time frame of the production version? We are still in "preview" releases, I am not sure whether it is ready for production

# re: ASP.NET MVC Preview 4 Release (Part 1)

Monday, July 14, 2008 9:58 PM by Paul Kohler

This is shaping up really nice. I have always been a big fan of convention over configuration. The inclusion of the authorization is great.

I too am wondering... how many more previews and whats the anticipated release date? Including the source has been a great move too BTW...

PK  :-)

# re: ASP.NET MVC Preview 4 Release (Part 1)

Monday, July 14, 2008 10:52 PM by Jarred Nicholls

Scott, I like the work with the built in Filters, but I will have to agree with Tim Hardy, who commented above.  Adding AJAX syntactic sugar to MVC is really a waste of time at this point.  I use Ruby on Rails quite a bit and the one thing I never use is the AJAX support built into it, because I use ExtJS for everything and hate prototype.  ASP.NET MVC should not even bother with it and leave the client-side up to the developer as the AJAX libraries out there today don't need any assistance, they're already quite good on their own.  The one AJAX framework I happen to despise is ASP.NET AJAX, which I hope you're not integrating into MVC :-)  I'm a hardcore .NET programmer since 1.0 and am knee deep in it, but I never ever use ASP.NET AJAX, it's simply sub-par to ExtJS and some other client libraries out there today and have enjoyed MVC to-date because of it being pure MVC and being client-agnostic.  Focus the time on the most important plumbing first and forget about the AJAX features.  Great work though, I always look up to you :-)

# MVC Filter Interceptors and more

Monday, July 14, 2008 11:45 PM by Contagious Curiosity

What you don't read ScottGu's blog?&#160; Who DOESN'T read his blog?&#160; Well, apparently me - the

# re: ASP.NET MVC Preview 4 Release (Part 1)

Tuesday, July 15, 2008 12:24 AM by Thrivng

Great job!Waiting for the Preview 4!

# re: ASP.NET MVC Preview 4 Release (Part 1)

Tuesday, July 15, 2008 12:26 AM by Jimmy Schementi

Regarding Dynamic Language support in ASP.NET MVC, we have a prototype that we'll make sure works on Preview4. Keep an eye out on blog.jimmy.schementi.com.

As far as what that prototype will be able to do, John Lam blogged about it after showing it at his TechEd talk: www.iunknown.com/.../ironruby-and-aspnet-mvc.html.

# re: ASP.NET MVC Preview 4 Release (Part 1)

Tuesday, July 15, 2008 1:12 AM by Jayasankar Pandyat

That's a great article. Thanx Scott!!

# re: ASP.NET MVC Preview 4 Release (Part 1)

Tuesday, July 15, 2008 2:06 AM by Josh

How many more preview releases are you expecting before this goes RTM?

I am really looking forward to using the framework but like many would be more comfortable with this goes RTM. Thanks.

# re: ASP.NET MVC Preview 4 Release (Part 1)

Tuesday, July 15, 2008 2:19 AM by Jeremy M

Thanks Scott, but I have to agree with Tim Hardy's post about where the focus is.  These attributes are nice but seem unnecessary.  We can (and do) write our own as long as the hooks are there.  I feel the same way about AJAX...you've given us JsonResult, so we can hook up jQuery or whatever just fine.  I'd rather see MVC stay pure and bloat-free.  Most importantly, let's get that RTM before end of year as rumored!!!

p.s. if folks on MVC team do have extra time, I'd vote for an MS version of an ISAPI rewrite filter for IIS6...I'm sure my client isn't the only one that refuses to install some 3rd party dll at such a critical interface.  Anyone agree?

# re: ASP.NET MVC Preview 4 Release (Part 1)

Tuesday, July 15, 2008 2:48 AM by panjkov

Scott, thank you for this excellent post. I have some questions:

1. You mentioned (in P3 introduction) that you'll post long tutorial article on ASP.NET MVC. When can we expect that article?

2. For which MVC drop we will have GoLive licence? I'd like to use it for my next project, and this fact will decide what to use - WebForms or MVC.

3. In your opinion, is current state of AccountController class mature enough for using in real world Membership situation and if yes, for how many users/current users (two quantities) can it service? Does AccountController class now have included mechanisms for user management (like Controller Actions and appropriate Views for administrators to use OOTB)

4. Stephen Walther in his recent blog post posted Creating of Controller, View and Test using VS macro. Does MVC team has plan to support something similar in ASP.NET MVC VS template? It would be nice if we could, when Creating Controller, automatically get its folder in Views, one View page (for default OOTB action) and ControllerTest class.

Thanks!

Dragan

# re: ASP.NET MVC Preview 4 Release (Part 1)

Tuesday, July 15, 2008 4:34 AM by Tamir Shlomi

Hi Scott,

Thanx the information about the upcoming preview 4.

Tamir.

# re: ASP.NET MVC Preview 4 Release (Part 1)

Tuesday, July 15, 2008 5:15 AM by ScottGu

Hi Christian,

>>>>>> im glad that ado.net and better linq support is added. Is there any way or chance that Silverlight will support MDX directly? ( no not webservice )

For security and download size reasons, Silverlight today doesn't support the ability to directly talk to a database.  Instead you'll need to use a web-service to retrieve and update data.  We will be make doing this a lot easier in the future (we'll have good tool and framework support for handling these scenarios).

Hope this helps,

Scott

# re: ASP.NET MVC Preview 4 Release (Part 1)

Tuesday, July 15, 2008 5:16 AM by ScottGu

Hi Simone,

>>>>>> Just one question: does this version already include something to enable 3rd party components (components with both view and controllers shipped in a separate assembly?

This build doesn't include additional support for components.  You can build views+controllers that live in a separate assembly, but the framework support for enabling a built-in encapsulation model for what you are looking for isn't there just yet.

Hope this helps,

Scott

# re: ASP.NET MVC Preview 4 Release (Part 1)

Tuesday, July 15, 2008 5:17 AM by Orion

Hi Scott, u promised article about validating data from forms. But this one is also good :o). I hope there will be not so many previevs before some release.

# re: ASP.NET MVC Preview 4 Release (Part 1)

Tuesday, July 15, 2008 5:18 AM by C.T.

great works, hope the last version

i am developing a business travel website now, using MVC+EntLib4.0+Jquery, have a nice experience than the post-back

# re: ASP.NET MVC Preview 4 Release (Part 1)

Tuesday, July 15, 2008 5:18 AM by ScottGu

Hi Izanca,

>>>>>>>> Any plan to integration/interaction between Authorize Filter, the AccountController and the "Zermatt" new itentity application development framwwork?

I need to investigate Zermatt more to be sure, but it sounds like it supports the standard User (IPrincipal) interface - in which case it should in theory work with the [Authorize] filter.

Hope this helps,

Scott

# re: ASP.NET MVC Preview 4 Release (Part 1)

Tuesday, July 15, 2008 5:19 AM by ScottGu

Hi Scooby,

>>>>>>> I (still) wonder about sub-controllers - will they be in the Preview 4 or when can we expect this most valuable feature?

Sub-controllers aren't in preview 4 yet I'm afraid.  It is something the team is planning to investigate more though.

Thanks,

Scott

# re: ASP.NET MVC Preview 4 Release (Part 1)

Tuesday, July 15, 2008 5:21 AM by ScottGu

Hi Peter,

>>>>>>> Hi Scott, love the blog, always a great read! One slightly (read completely) off topic question, what theme are you using for VS? It looks fantastic!

I have a slightly custom theme that I use.  You can download it here: www.scottgu.com/.../scottgu-dark.zip

Hope this helps,

Scott

# re: ASP.NET MVC Preview 4 Release (Part 1)

Tuesday, July 15, 2008 5:21 AM by ScottGu

Hi Swapna,

>>>>>> Can you please give some date as to when will the ASP.Net MVC go live?

You can go live with ASP.NET MVC today.  The license supports production deployments.

Hope this helps,

Scott

# re: ASP.NET MVC Preview 4 Release (Part 1)

Tuesday, July 15, 2008 5:22 AM by ScottGu

Hi Dominic,

>>>>>>> Please tell me Form Validation controls are in this release, please!!

Form validation and some post helpers aren't in Preview 4 unfortunately.  They are the top feature for the next preview though - so will hopefully be here soon.

Hope this helps,

Scott

# re: ASP.NET MVC Preview 4 Release (Part 1)

Tuesday, July 15, 2008 5:25 AM by ScottGu

Hi Ronnie,

>>>>>>> Can you also give us a general overview of things to come (after preview 4)? Or delegate it to someone else and share the link :)

The team is still working on the exact feature-list, but form validation/post scenarios is the top of the list for the next preview, along with some work to finish up the AccountController and AJAX work, along with some testing improvements, and VS integration support (project wizard, new item wizards, etc).  Once these pieces are done the "core" MVC 1.0 framework should be pretty solid and baked.  

Hope this helps,

Scott

# re: ASP.NET MVC Preview 4 Release (Part 1)