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: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: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

# 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 )

# 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

# 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.

# 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...

# 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!!

# 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 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 :)

# 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!

# 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.

# 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

# 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 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 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 :-)

# 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 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)

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

Hi Tom,

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

Yes - you can run ASP.NET MVC on Mono.  The license doesn't have any issues with this.

Thanks,

Scott

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

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

Hi Robi,

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

You can update the web.config file of the application to use the ActiveDirectory Membership provider - at which point you will use Forms Authentication and the AccountController to verify windows credentials.

If you want to use Windows authentication, just set <authentication mode="Windows"/> in the web.config file, at which point ASP.NET will identify the user using windows auth.  The AccountController in this case isn't required anymore - since the user never explictly needs to login.

Hope this helps,

Scott

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

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

Hi Joe,

>>>>>>>> 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?

Preview 3 actually supported this too (you can also return string as the data-type).  I find this sometimes looks aesthetically more pleasing (shorter type name), etc.  The runtime semantics are the same though.

Hope this helps,

Scott

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

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

Hi Marco,

>>>>>>> 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).

Yes - the team was just talking about that today.  I agree it would be a nice feature to have.

>>>>>>> What about Ajax support for JQuery?

ASP.NET MVC works great with JQuery.  Our server side helpers will also be pluggable, and allow you to plug in JQuery, Prototype, ExtJs or any other AJAX framework you want into ASP.NET MVC.

Hope this helps,

Scott

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

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

Hi Pure,

>>>>>>> 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 ;)

I'll be showing some JQuery code samples in my next post on ASP.NET MVC with AJAX as well.

Hope this helps,

Scott

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

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

Hi VB,

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

Dynamic data support for MVC isn't in this preview.  The Dynamic Data team is looking to ship a preview of the scaffolding support later this summer though.

Hope this helps,

Scott

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

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

Hi Ben (subdigital),

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

No changes for this in Preview 4.  It is something that I know the team is thinking about though (they want to make a pass through all the view helpers and clean/up enhance a few).

Thanks,

Scott

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

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

Hi Steve,

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

I think Beta1 probably isn't far off now.

Hope this helps,

Scott

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

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

Hi Zsolt,

>>>>> 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)

Here is a pointer to my VS theme that you can download: www.scottgu.com/.../scottgu-dark.zip

Hope this helps,

Scott

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

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

Hi Joe,

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

I believe so - since under the covers it is using Session state (and the SQL session state implementation uses serialization).  Let me know if you have any problems in using it.

Thanks,

Scott

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

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

Hi Omeganot,

>>>>>>> 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!

Yes - the last month has been pretty busy for me.  My wife and I just had a baby, and he is keeping us very busy. :-)

Thanks,

Scott

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

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

Hi Tim,

>>>>>>>> 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.

I'll post more details on our AJAX support with my next blog post.  At a high-level, though, our helpers will support the ability to plug-in any client-side AJAX framework.  This hopefully makes it easy to easily use whichever framework you want with ASP.NET MVC.

Hope this helps,

Scott

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

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

Hi Orion,

>>>>>>> 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.

We are still working on our plans for View specific tests, and aren't sure when that support will show up yet.  It is something on our roadmap - although not clear whether for the initial V1 release or a V1.1 release.

Hope this helps,

Scott

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

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

Hi Dave,

>>>>>>>> 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

The AccountController is focused mostly on the end-user interaction with user accounts as opposed to the backend admin management of them.  If you are using IIS7, you can now use its built-in admin tool support for doing this against an application membership store.  Alternatively, you could add an AdminController to the application to implement this functionality embedded within the application.  Ideally it would be great if the MVCContrib project included a built-in implementation of this that anyone could use.

Hope this helps,

Scott

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

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

Hi Paul (and others),

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

We are getting close to the official beta, after which RTM won't be that far off.  There are still a few feature areas that need to be finished (and one or two that still need to be started and then finished).  But hopefully we'll be feature complete for V1 in the not too distant future.

Hope this helps,

Scott

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

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

Hi Jarred,

>>>>>>>>> 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 :-)

The ASP.NET MVC AJAX helpers will be pluggable - meaning they can work with any client-side AJAX framework.  So if ExtJS is your favorite you'll be able to use all of the ASP.NET MVC AJAX APIs I'll show with it.

Hope this helps,

Scott

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

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

Hi Dragan,

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

I need to finish this one up.  My wife and I had a baby shortly after that post, and so I didn't get a chance to publish it.  I'm planning on trying to get it done later this summer with this most recent preview build.

>>>>>>>>> 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.

You can use MVC today for production applications (no golive license required - the MVC license already allows production deployment and usage).

>>>>>>>>>> 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)

The AccountController uses the ASP.NET Membership API - which is mature enough to use.  There are a few features we'd like to add to AccountController (like URL based activation and password retrieval).  These are easy to add today, but aren't built-in yet.

>>>>>>>>>> 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.

Yes - the next preview of ASP.NET MVC will have built-in wizards and context menu items that automate common VS tasks.

Hope this helps,

Scott

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

Tuesday, July 15, 2008 6:14 AM by Dave Mertens

The new features are very nice (although we already created our own cache and membership handlers).

However, I think It's wise to include two MVC project templates in de VSI package. The current templates are slowly turning into a starter kit. An 'empty' MVC template project would be very  appreciated.

One last thing, the source code from codeplex contains a lot of internal protected properties and fields which makes it sometimes very hard to customize the functionality. Currently we just copy the codeplex source code and make our changes. We've created a MVC default configuration provider which makes it possible to change the 'default' ControllerFactory, ViewEngine, ViewLocator, etc. In the next few days I will upload the patch to teh codeplex project.

Thanks and keep up the good work.

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

Tuesday, July 15, 2008 7:00 AM by Pradeep Sharma

Hi Scott,

Great. When will release the Preview 4?

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)

Tuesday, July 15, 2008 7:01 AM by panjkov

@Scottgu: Thank you for your response. Congratulations for newborn baby in your family and for little one long and happy life :)

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

Tuesday, July 15, 2008 7:30 AM by pure krome

@Guru Gu: zomg - congrats dude on having a new addition to the family! Welcome aboard mini-gu v0.1 RTL (release to life). I'm also a new father with a mini-pk v.05 giving us lots of love and smiles :)

We all miss you and the blog posts but i'm sure it's fair to say we're all excited to hear about the great news! Good stuff and pass on the warm regards to your wife too.

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

Tuesday, July 15, 2008 8:31 AM by rkanungo

Hi Scott, gr8 doing..Congratulations on the arrival of the little member in your family..

I am new to MVC and have been going through all your previous postings and this one too..A quick question on the error handling...If I raise a custom exception in my Model class (e:g if data[0] == null, throw new exception ("Null Error")) , how will I handle the error ? Will it automatically get redirected to the Error view or I have to explicitely catch it from the controller class ?

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

Tuesday, July 15, 2008 10:42 AM by MVC User

long time no see......

when will the ASP.NET MVC Framework Preview 5 be released? I am looking forward to getting the UI components, just like some function in Dynamic Data

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

Tuesday, July 15, 2008 11:10 AM by simonech

@ScottGu: Thank you for the answers about subcontrollers and encapsulation of view+controllers.

And congrats on your baby.

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

Tuesday, July 15, 2008 2:41 PM by sam dlg

I'm very happy with the new framework and I've already built an awesome mini app that uses jquery and mvc and "it just works".  

I'm very interested in seeing how you integrate jquery/asp.net mvc and security...Please speak a little to the best approach for this...that's the one thing that's holding me back from taking this thing live.

Great job!  I'm still drooling over this new framework...love it!

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

Tuesday, July 15, 2008 3:39 PM by Kevin Dente

Congrats on the new member of your family. I suppose we can forgive your temporary absense. ;)

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

Thursday, July 17, 2008 12:05 AM by mgutz

i agree with the wasted effort on the AJAX. it is so easy to do with existing, proven and polished open source libraries. if one can't figure out how to do AJAX updates with jQuery, YUI he should not be using MVC. here's the reason i use ASP.NET MVC: no webforms, no ASP.NET AJAX.

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

Thursday, July 17, 2008 12:46 AM by chhaysambo

Great post!

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

Thursday, July 17, 2008 1:18 AM by wangls

in Application_AuthenticateRequest event,

How to get the Controller name and methods name from the request.

Thanks lot.

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

Thursday, July 17, 2008 8:56 AM by aL

hey grats on the baby as well :D hope there were no release issues or bugs :)

looking forward to that ajax post but dont rush it, spend time with the baby and have some time of :)

thank you for all your work with asp.net and .net in general!

you're a programmers rock star man :)

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

Thursday, July 17, 2008 10:12 AM by Steve

I'm getting new errors with Preview 4 :

"The provider requires SessionState to be enabled."

My application no longer works.

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

Thursday, July 17, 2008 10:25 AM by Steve

Scott,

I'm now getting this error:

The provider requires SessionState to be enabled.

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

Thursday, July 17, 2008 11:44 AM by budigelli

Can't wait to play with the preview 4 bits...great post...

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

Thursday, July 17, 2008 12:07 PM by Zygimantas Berziunas

Tip. If sample template, there is a code line to check if request method is "POST":

if (Request.HttpMethod == "POST")

If you would like to get Intellisense help you can use System.Net.WebRequestMethods.Http class, like this:

if (Request.HttpMethod == System.Net.WebRequestMethods.Http.Post)

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

Thursday, July 17, 2008 12:28 PM by Ngoc

Hi Scott, was App_Themes supported in Asp.net MVC?

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

Thursday, July 17, 2008 1:57 PM by Steve

Scott, I think you are the coolest guy at Microsoft.  Do you agree?

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

Thursday, July 17, 2008 4:23 PM by MobileMVC

Currently, ViewPage is derived from Page. Will ASP.NET MVC support MobilePage? Such as ViewMobilePage?

Thanks.

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

Thursday, July 17, 2008 4:55 PM by Matt

We have a mapping application and using AJAX we get the latitude and longitude as our response.  I need to be able to pass the response to the onsuccess function.  How does that work?

I love the blog and I love what you guys are doing with this.  Thanks a ton.

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

Thursday, July 17, 2008 8:15 PM by MobileMVC

This is great stuff!  Currently, ViewPage derives from Page.  Will there be a MobileViewPage that derives from MobilePage?  How can I use ASP.NET MVC with MobilePage?

Thanks.

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

Friday, July 18, 2008 3:17 AM by aL

congratulations on your baby :) i hope there were no post release bugs :)

looking forward to that next post, but dont rush it, you deserve some time off :) (although it might be even more relaxing to get back to work after a while :D )

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

Friday, July 18, 2008 3:47 AM by hj

When will Part 2 of the post be ready? Hurry :)

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

Friday, July 18, 2008 6:40 AM by Jason

Quite agree with the wasted effort on the AJAX. it is so easy to do with existing, proven and polished open source libraries. if one can't figure out how to do AJAX updates with jQuery, YUI he should not be using MVC. here's the reason i use ASP.NET MVC: no webforms, no ASP.NET AJAX.

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

Friday, July 18, 2008 8:10 AM by Seb

Hello and thanks for your excellent job!

Why did SubmitButton move to Microsoft.Web.Mvc.dll file??

We can't now use Html.SubmitButton but ButtonBuilder.SubmitButton...

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

Friday, July 18, 2008 9:02 AM by roamer

That was a nice article, future is for MVC.

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

Friday, July 18, 2008 9:50 PM by Corey Gaudin

Scott,

I noticed a couple of responses back you had mentioned supporting Validation via the model (which I can only assume that means attribute markup of some type). I was wondering how this will play with Entity Framework. Meaning, if the support for validation for the model data is done via attributes, how will we be able to mark up the entity objects we want to pass (filtered however) to the View?

If all else fails, then we can just copy into a dump object from the entity and that would be marked up, but we would be stuck writing a transport objects. I really like what Entity Framework brings to us, I hope there is some nice seamless way to setup the Entities such that validation would be easy via MVC.NET.

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

Saturday, July 19, 2008 4:57 AM by Andy

This is a bit offtopic, but some time ago you wrote this:

"LINQ to SQL data model entities don't maintain any connection state - which means you can pass them across tiers or logical business classes. You can also serialize/deserialize them across a web-service or other remoting technology.

I'll be covering how to-do this (and then re-attach them to a database context) in an upcoming blog post in my series. I think you'll find this provides a pretty clean and flexible way to implement a N-tier model.

Hope this helps,

Scott

scottgu | Homepage | 08.28.07 - 5:06 pm "

When will that article happen please? Many of us are actually very interested in your solution to the core problem of LINQ.

Thank you.

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

Saturday, July 19, 2008 6:10 AM by Ahtesham ul haq

scott,

hope this preview has more controls on Views (as u promised) last time . Also what about sub controller .

Ahtesham

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

Tuesday, July 22, 2008 7:54 PM by jlembke

Really sorry if I missed documentation on this, but if I add my own MapRoute after the Default route generated by a new project in globaql.asax the application gives me a 404 on the request for the new controller. However, if I put my own route before the Default MapRoute, it sees it fine. Is this by design?

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

Tuesday, July 22, 2008 11:43 PM by jewelFromAlampur

Thanks Scott Gu for the development of MVC,development of the world

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

Wednesday, July 23, 2008 10:26 AM by UK Web Hosting

Wow preview 4 is looking really interesting, thanks for the update Scott!

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

Thursday, July 24, 2008 1:15 AM by shiju

Hi Guru Gu,

We are waiting for the part 2 post.

Thanks

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

Thursday, July 24, 2008 10:18 AM by GeoffMS

This may not be the correct place to post this, but I could not find a post about the following issue:

I use VS 2005 and allow users to Upload Image Files using a FileUpload Control. The user Images are stored in a UserUploads Folder on the destination website.

The problem is the UserUploads folder gets BLOWN-OFF everytime the site is re-published.

I looked for ways to configure the Publsih to NOT delete all files, but to preserve or exclude the UserUploads folder on the remote/destination. However, the VS2005 Publish always deletes everything, and we lose all previous UserUploads content on the destination.

How do we configure VS2005 to ingore the one UserUploads Folder on the destination when it publishes?

Thanks!

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

Thursday, July 24, 2008 6:28 PM by ol3j

Hi,

I have to install MVC Preview 4  on server if i have mvc dll in lib or bin folder. I have error

Parser Error Message: Could not load file or assembly 'System.Web.Abstractions, Version=0.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.

Source Error:

Line 35: <add assembly="System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>

Line 36: <add assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>

Line 37: <add assembly="System.Web.Abstractions, Version=0.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>

Line 38: <add assembly="System.Web.Routing, Version=0.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>

Line 39: <add assembly="System.Data.DataSetExtensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>

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

Wednesday, July 30, 2008 4:26 AM by rabeehabla

We are using “LINQ to SQL classes” in V.S 2008 as the application data layer, my question is can “LINQ to SQL classes” be upgraded to “Entity Data Model”, or should we create a new EDM XML file?

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

Friday, August 1, 2008 1:55 PM by michael_lin01

1. Is it possible to create a setup package such that it does not require to remove the previous version?  The reason I ask this is important for my second question.

2. Because most likely, new release will only modify/add a limited files to the existing web project, is it possible to only copy newer file(s) to the targeted computer?  If the file being copied is not later than the existing, we may know there is potential problem in the build.

Thanks,

Michael

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

Monday, August 4, 2008 6:27 AM by rmmason

Hi Scott,

Great work on the MVC framework. Were really excited about using it in some of our projects!

Is there anywhere where we can get a roadmap of upcoming features to be added to the MVC framework? Also any ideas of an official release date for the final version?

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

Monday, August 4, 2008 7:41 AM by madhyastha

Hi Scott,

I am a regular visitor to your site. I am just wondering what is the difference between MVC Preview 4 and Web Client Software Factory - February 2008 - even it is a MVC f/w. I am using WCSF.

Let me know

Thanks,

Sree

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

Wednesday, August 6, 2008 5:03 PM by MehrdadAfshari

nice job!

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

Thursday, August 7, 2008 7:12 AM by bjartn

How would you configure the HandleError filter to return the error as a JSON object ? Is this supported ?

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

Thursday, August 14, 2008 12:01 AM by aktxyz

2 comments...

1) why does the "official" asp.net site still point to preview 3?

http://www.asp.net/mvc/

2) it would be great if your blog had the date and number of comments right next to the title for each post (especially the date).  kind of like the techcrunch blog.  that way I don't have to scroll to the bottom of the post to see if I am readying something old!

great blog, thanks for all the hard work.

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

Wednesday, August 27, 2008 6:29 PM by Renso

Scott, the flow of the process pattern for when errors occur is still eluding me. For example, when I perform an EDIT action on my controller, it obviously Renders the EDIT view with some controls pre-filled with data from the database. However, once the user hits submit, calls the UPDATE action on the same controller in this case. The controller no fetches my data again from the database and populates my Domain object, after which it also updates it with the data from the request object (in my case the EDIT screen does not contain all the data on the Domain so I have to get it first from the database). It now runs validation on the Domain and finds an error. In some examples I see that the UPDATE action only updates the data on the DB and then Redirects to the Category (List) action (i.e. does not call RenderView directly for the Category  view), the latter getting the updated data again from the DB and displaying the list on the Category screen. However, the problem in my scenario here is that an error occurred during the UPDATE, on an error do I RenderView the EDIT screen directly, if not and I Redirect to EDIT, how do I pass the error messages and the data that the user attempted to change on the EDIT screen from the UPDATE action to the EDIT action? It seems that I should let the UPDATE action RenderView to whatever view it wants directly rather than  Redirecting? What is the pattern we need to use to decide when to Redirect to an action in the same controller as apposed to RenderView directly?

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

Friday, August 29, 2008 12:09 AM by Ste010

Nice to see an MVC framework for ASP.Net

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

Friday, August 29, 2008 9:25 AM by mcp111

How come you don't have anything on asp.net mvc preview 5 on your blog?

www.codeplex.com/.../ProjectReleases.aspx

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

Monday, September 1, 2008 5:35 AM by AndreyKuzmenko

When will be the next part?

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

Tuesday, September 2, 2008 6:38 AM by Celik

Nice job on MVC.

BTW preview 5 is out on codeplex?

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

Wednesday, September 3, 2008 2:43 PM by Sarel

Hi.

Where is the App_Code folder in MVC or where should I put the class file that I want to contain the authentication logic?