ASP.NET MVC CodePlex Preview 5 Released

Download the MSI and Release notes here.

Last night we released ASP.NET CodePlex Preview 5 on CodePlex. Be on the lookout for one of those famous epic blog posts from ScottGu describing the release. In the meanwhile, the release notes contain short write-ups of what has changed.

We didn’t originally plan to have another preview. However, we implemented a few significant chunks of functionality and were dying to get feedback so that we could incorporate it into the product before Beta. It helps that with five or so of these interim releases, we’ve become pretty efficient producing these releases.

We plan to have our next release be our official Beta, which means we’ll have a lot more test passes to produce and run before we release the next one.

In the meanwhile, take the code for a test drive and let us know what you think. Some of the naming needs to be cleaned up, so you can expect some name changes and improvements to the API from here to Beta, along with a lot of bug fixes and a few more features. Naming classes is tough, so we appreciate good suggestions there. :)

One change that I think I forgot to mention in the release notes is that the Ajax helpers do not accept inline script any longer, they take method names. Those helpers are all in their own namespace now as extension methods which allow you to completely swap them out with ones of your own.

If you’re interested in more details about how our action method selection works, be sure to read my post entitled How a Method Becomes an Action. Be sure to keep an eye on Brad Wilson’s blog too, as he put in some work on this feature and will describe the view engine changes.

UPDATE: Brad just blogged about partial rendering and view engines in ASP.NET MVC.

Technorati Tags: ,

What others have said

Requesting Gravatar... Simone Aug 29, 2008 7:57 AM
# re: ASP.NET MVC CodePlex Preview 5 Released
Next one will be a Beta... that's a great thing to know. Thanks for sharing this.
Requesting Gravatar... Seth Rowe [MVP] Aug 29, 2008 8:02 AM
# re: ASP.NET MVC CodePlex Preview 5 Released
Great to hear that we have another preview to play with - though I think you caught us all off guard. Even better is the lack of major breaking changes in the release!

Any word on a scheduled release date for the beta (or even the number of planned betas)?
Requesting Gravatar... Scott Aug 29, 2008 8:15 AM
# re: ASP.NET MVC CodePlex Preview 5 Released
Yay! Something to play with while my wife and kid are out of town.
Requesting Gravatar... Remco Ros Aug 29, 2008 9:00 AM
# re: ASP.NET MVC CodePlex Preview 5 Released
I didn't find anything in the release notes on User Controls? What happened to RenderUserControl? Is this replaced by RenderPartial? How do we use it?

Requesting Gravatar... Shiny Zhu Aug 29, 2008 10:08 AM
# re: ASP.NET MVC CodePlex Preview 5 Released
Great jobs! I've just blogged a Chinese post introduce this release.

Will the official beta come to us next month?
Requesting Gravatar... haacked Aug 29, 2008 10:31 AM
# re: ASP.NET MVC CodePlex Preview 5 Released
@Remcos yes, use RenderPartial instead of RenderUserControl. UserControls are specific to the WebFormViewEngine. RenderPartial works with any view engine that supports it (which I imagine we'll see the others updated soon).
Requesting Gravatar... Derik Whittaker Aug 29, 2008 11:11 AM
# re: ASP.NET MVC CodePlex Preview 5 Released
Phil,

When i try to use RenderPartial I am getting the following
"The best overloaded method match for 'System.IO.TextWriter.Write(char)' has some invalid argument"

U got any examples on how to use this method correctly?
Requesting Gravatar... Mike Aug 29, 2008 12:05 PM
# re: ASP.NET MVC CodePlex Preview 5 Released
I think RenderPartial deserves a big write up from you or ScottGu or whoever is best qualified. The reason is because it is the third version of 'user controls' that you tried. Of course, we see more because you release more, so we see early builds. But I want to know if this is the way it's going to be in the future, or will it change again. Also, a really detailed explanation of how you got there. I never quite understood why the previous versions were dropped, I couldn't get my head around the cons that I saw posted on the forums.

I also gor interested in Ruby on Rails and noticed that they had a similar 'problem'. They have dropped support for one way of doing partials even after v1. So, is this problem just not well understood in web MVC type 2 frameworks? I mean, if the Rails guys and even Microsoft struggles with it, is it that big of a challenge?

Thanks!
Requesting Gravatar... Mike Aug 29, 2008 12:22 PM
# re: ASP.NET MVC CodePlex Preview 5 Released
Please provide support for 'areas', I didn't see it in the changes. Look at this to see what the current situation is now:

blog.codeville.net/.../implementing-a-custom-ro...

Thanks for considering, I'd love a comment from you on this feature. Is it not possible because Routing already shipped?
Requesting Gravatar... Ryan Aug 29, 2008 12:27 PM
# re: ASP.NET MVC CodePlex Preview 5 Released
I don't see any updates on Scott Gu's blog in the last six weeks. Any idea of when we will get a post about the new and partially documented features in Preview 5?

I agree completely with Mike. We really need to see some documentation around RenderPartial.
Requesting Gravatar... Brad Wilson Aug 29, 2008 1:53 PM
# re: ASP.NET MVC CodePlex Preview 5 Released
@Mike,

Ask and ye shall receive. :)

bradwilson.typepad.com/.../partial-renderi.html
Requesting Gravatar... Lamin Barrow Aug 29, 2008 3:00 PM
# re: ASP.NET MVC CodePlex Preview 5 Released
Yay.. i have been on the lookout for something like this. Preview 5 sounds very exciting. Thanks Phil and the team.
Requesting Gravatar... Throwspoop Aug 29, 2008 9:38 PM
# re: ASP.NET MVC CodePlex Preview 5 Released
Any idea why this error would occur: "The UrlRoutingHandler is not used to directly handle requests."

Its failing here:

public void Page_Load(object sender, System.EventArgs e)
{
HttpContext.Current.RewritePath(Request.ApplicationPath);
IHttpHandler httpHandler = new MvcHttpHandler();
httpHandler.ProcessRequest(HttpContext.Current);
}

In Default.aspx....i don't recall there being code in here in previous releases. Note that I just created a new MVC web project and tried to run it - this isn't a project promoted from release 4.
Requesting Gravatar... Throwspoop Aug 29, 2008 11:30 PM
# re: ASP.NET MVC CodePlex Preview 5 Released
For reference here is the Preview 4 default.asp page_load:

public partial class _Default : Page
{
public void Page_Load(object sender, System.EventArgs e)
{
Response.Redirect("~/Home");
}
}
Requesting Gravatar... Jahedur Rahman Aug 30, 2008 1:56 AM
# re: ASP.NET MVC CodePlex Preview 5 Released
Great to hear it :)
Requesting Gravatar... shawn Aug 30, 2008 6:20 AM
# re: ASP.NET MVC CodePlex Preview 5 Released
@Derik

Replace <%=Html.RenderUserControl("foo.aspx",model)

with

<%Html.RenderParital("Foo")
Requesting Gravatar... Corey Gaudin Aug 30, 2008 11:21 PM
# re: ASP.NET MVC CodePlex Preview 5 Released
Just in case anyone needs this when going from Preview 4->5:

-If you are looking for "UpdateFrom" from BindingExpression, its gone, instead use in the Controller class (its protected inside it now) UpdateModel

-If you are having issues with Html.TextArea, add an extra null at the end of the parameter list (for HTMLAttribs)

-If you are having issues with Html.Checkbox, the parameter list has changed alot, there is no value and text now.

-If you are having an issue with BuildUrlFromExpression ..., then you will need to look into the Microsoft.Web.Mvc dll (it is under LinkBuilder)

-Several things have been removed that I have yet to find a way around (like the ActionMethod property from ActionFilters)


We definitely need a posting on the new features such as Validation additions (and how it works behind the scenes), Ajax changes, Return type of PartialView from controller, etc.
Requesting Gravatar... Magnus Mårtensson Aug 31, 2008 12:12 AM
# re: ASP.NET MVC CodePlex Preview 5 Released
Next is Beta time! ;~) Great, now finally I may be able to persuade a customer to begin production development on MVC! Thanks, /Magnus
Requesting Gravatar... Throwspoop Aug 31, 2008 5:20 PM
# re: ASP.NET MVC CodePlex Preview 5 Released
@throwspoop: Any idea why this error would occur: "The UrlRoutingHandler is not used to directly handle requests."

This was caused by the fact that I still have VS2008 SP1 installed on machine. Update to the RTM SP1 and all is good.
Requesting Gravatar... Throwspoop Aug 31, 2008 5:43 PM
# re: ASP.NET MVC CodePlex Preview 5 Released
Correction: I had VS2008 Beta 1 installed on my machine...
Requesting Gravatar... Ronnie Hoogland Sep 01, 2008 6:00 AM
# re: ASP.NET MVC CodePlex Preview 5 Released
Phil,

When you guys release a preview does the code already go through StyleCop or is that a beta activity? And are you using a different rule set than the one you get with the StyleCop download?
Requesting Gravatar... haacked Sep 01, 2008 11:11 AM
# re: ASP.NET MVC CodePlex Preview 5 Released
We run everything through Code Analysis (FxCop). We don't run anything through StyleCop AFAIK.
Requesting Gravatar... Steve Sep 01, 2008 1:18 PM
# re: ASP.NET MVC CodePlex Preview 5 Released
Thanks Corey - it would have been nice to see that in the readme.

I think getting mvccontrib running is first priority :)
Requesting Gravatar... Steve Sep 01, 2008 1:26 PM
# re: ASP.NET MVC CodePlex Preview 5 Released
Anyone know what happened to the CheckBoxBuilder ?

Requesting Gravatar... Steve Sep 01, 2008 1:31 PM
# re: ASP.NET MVC CodePlex Preview 5 Released
Anyone know what happened to ReadFromRequest ?

Requesting Gravatar... Steve Sep 01, 2008 1:40 PM
# re: ASP.NET MVC CodePlex Preview 5 Released
I must say, this preview 5 release is the worse I've seen so far. Maybe because ScottGu isn't around?

Previously, the readme would include breaking changes, this release document barely gives any information and there is much that isn't working. Where is the 'moving from preview 4 to preview 5 changes?'

I give MS a 1 out of 5 on this preview, which is too bad, prior to this it was done very well...

Guess I'm really surprised to see 'ReadFromRequest' gone without any mention of it at all.

Too bad I've used it all over the place - seems rather useful - why is it gone?
Requesting Gravatar... Eric Glanz Sep 01, 2008 1:51 PM
# re: ASP.NET MVC - Crash on Views
I just installed Preview 5, and Visual Studio 2008 crashes whenever I attempt to load a view in either designer or markup mode. Any ideas on why this would be happening?
Requesting Gravatar... Steve Sep 01, 2008 1:54 PM
# re: ASP.NET MVC CodePlex Preview 5 Released
DropDownList now takes a "optionLabel" - no other overload without it - so now all my dropdownlists much have some sort of --select one--??

What if I don't want that. Sure, it's nice to have, but why assumed I want it no matter what???)
Requesting Gravatar... Steve Sep 01, 2008 2:02 PM
# re: ASP.NET MVC CodePlex Preview 5 Released
ok, so you pass an empty string it doesn't show a label.

lol - that is odd isnt it?
Requesting Gravatar... Steve Sep 01, 2008 2:20 PM
# re: ASP.NET MVC CodePlex Preview 5 Released
What happened to the ActionLink<> ?

This was, I thought, done rather well - using Lamba expressions, etc..

Is this gone now?

ie. this is what I had before:
<%= Html.ActionLink(c => c.DoSomething(), "DoSomething", new { Target = "_blank" })%>

Worked great - not sure the reason for this new change that doesn't seem to support this?
Requesting Gravatar... Steve Sep 01, 2008 2:32 PM
# re: ASP.NET MVC CodePlex Preview 5 Released
ok sorry :(

lol - I see it's been moved to the Microsoft.Web.Mvc

Things see a bit spread out now between the assemblies I think , is there a certain approach you guys are taking to this ?

ie. What is System.Web.Mvc vs. Microsoft.Web.Mvc ? Do you see 'controls' as being in the Microsoft namespace ? Or is this a gradual move away from the 'System' namespace?
Requesting Gravatar... Steve Sanderson Sep 02, 2008 2:06 AM
# re: ASP.NET MVC CodePlex Preview 5 Released
Lots of cool new stuff to play with... Nice work with the AntiForgeryToken bits. Looking forward to some detailed explanation of the new ModelState stuff.
Requesting Gravatar... Jarda Jirava Sep 02, 2008 6:49 AM
# re: ASP.NET MVC CodePlex Preview 5 Released
Hi Phill,
thank you for your next step to the beta.
I have one question or maybe requirements because I didn't find this yet. Is there any chance how to create a link or redirect to the url with anchor (#)?
Thank you and have a nice day.
--J.
Requesting Gravatar... haacked Sep 02, 2008 9:53 AM
# re: ASP.NET MVC CodePlex Preview 5 Released
@Steve The Microsoft namespace represent bits that might not make it into the core, but we might include in the future.

@Steve Sanderson Cool! We didn't put it into the core because we don't yet have a full security review of it. We don't want to make any claims with it until we know it'll be somewhat effective. Glad to see you writing it up though.
Requesting Gravatar... labilbe Sep 13, 2008 8:10 PM
# re: ASP.NET MVC CodePlex Preview 5 Released
What is this input hidden field added when you call Html.Checkbox ?
Requesting Gravatar... Tim Van Wassenhove Sep 16, 2008 9:31 AM
# re: ASP.NET MVC CodePlex Preview 5 Released
I can confirm the vs2k8 sp1 crashes :/
Requesting Gravatar... James Taylor Sep 19, 2008 7:50 AM
# re: ASP.NET MVC CodePlex Preview 5 Released
I was also having a problem with Visual Studio 2008 SP1 crashing every time I tried to open a View. I uninstalled "PowerCommands for Visual Studio 2008" and the problem has gone away. I don't have time to investigate why this worked, but wanted to share this just in case it helps anyone else out.
Requesting Gravatar... Radek Sep 25, 2008 2:20 AM
# Encoding querystring
Hi Phil, I have one short question: Why don't you encode & sign in querystring when generating URL?


Url.Action("Action", "Controller", new {sad = true, happy = false}


will generate:


href="/app/Controller/Action?sad=True&happy=False


which breaks XHTML rules. HtmlAttributeEncode can maybe do the magic.

Oh, there is one more more question: Where is the right place to put such question? =)
Requesting Gravatar... Samiq Sep 28, 2008 11:36 PM
# re: ASP.NET MVC CodePlex Preview 5 Released
There are also breaking changes in Html.DropDownList which now request for a optionLabel which inserts a non-value option at the top of the combo box, I think this should be optional. There are times where I don't like this to be generated.
Requesting Gravatar... M Sep 29, 2008 8:20 AM
# re: ASP.NET MVC CodePlex Preview 5 Released
How should I reference to Microsoft.Web.Mvc? It's not a strongly named assembly. I would like to use the LinkBuilder.
Requesting Gravatar... hudo Oct 01, 2008 1:42 AM
# re: ASP.NET MVC CodePlex Preview 5 Released
VS crashes when opening aspx view :(

What do you have to say?

(will show your gravatar)
Please add 8 and 7 and type the answer here: