Updated Northwind Demo For ASP.NET MVC Preview 3

I updated the template to have the correct assembly references so it should work now out of the box. Sorry about that.

northwindA while ago Scott Hanselman linked to my Northwind sample which itself was spawned from an initial sample that Brad Abrams wrote.

As I like to say (to anyone who will listen)

There ain’t no party like a Northwind Party

So I went and updated my sample to work well with the recently released ASP.NET MVC Preview 3.

Download it here.

What others have said

Requesting Gravatar... shiju May 27, 2008 10:11 PM
# re: Updated Northwind Demo For ASP.NET MVC Preview 3
When running the demp application I am getting error "Could not load file or assembly 'System.Web.Mvc' or one of its dependencies. Strong name signature could not be verified. The assembly may have been tampered with, or it was delay signed but not fully signed with the correct private key. (Exception from HRESULT: 0x80131045)"
Requesting Gravatar... Adrian May 27, 2008 10:46 PM
# re: Updated Northwind Demo For ASP.NET MVC Preview 3
Same problem here when attempting to run the tests...

Cheers,

Adrian.

TestCase 'UnitTests.Controllers.ProductsControllerTest.CanListProductsByCategoryId'
failed: System.IO.FileLoadException: Could not load file or assembly 'System.Web.Mvc, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. Strong name validation failed. (Exception from HRESULT: 0x8013141A)
System.IO.FileLoadException: Could not load file or assembly 'System.Web.Mvc, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. Strong name validation failed. (Exception from HRESULT: 0x8013141A)
File name: 'System.Web.Mvc, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' ---> System.Security.SecurityException: Strong name validation failed. (Exception from HRESULT: 0x8013141A)
The Zone of the assembly that failed was:
MyComputer
at UnitTests.Controllers.ProductsControllerTest.CanListProductsByCategoryId()
Requesting Gravatar... Martin May 28, 2008 1:21 AM
# re: Updated Northwind Demo For ASP.NET MVC Preview 3
Same problem, but I fixed it by removing the references to the three MVC assemblies, and adding them again but referencing the ones installed into Program Files\Microsoft ASP.NET\ASP.NET MVC Preview 3\Assemblies
Requesting Gravatar... Steve May 28, 2008 6:08 AM
# re: Updated Northwind Demo For ASP.NET MVC Preview 3
I get same errors, referencing from preview 3 didn't change the errors.

I can run the new preview 3 but not this demo.
Requesting Gravatar... Johan Danforth May 28, 2008 6:17 AM
# re: Updated Northwind Demo For ASP.NET MVC Preview 3
Fixing the references makes the project run, but CanUpdateProduct and CanEditProduct tests fail with a NullReferenceException at this part:
void SetInvalid(string key) {
TempData["Error:" + key] = Request.Form[key];
}
Requesting Gravatar... Steve May 28, 2008 9:07 AM
# re: Updated Northwind Demo For ASP.NET MVC Preview 3
I get this error

Could not load file or assembly 'System.Web.Routing, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

even after referencing the new assemblies
Requesting Gravatar... Steve May 28, 2008 9:14 AM
# re: Updated Northwind Demo For ASP.NET MVC Preview 3
Update: doing a 'clean solution' and rerunning appears to have worked. (after referencing the new assemblies)
Requesting Gravatar... Haacked May 28, 2008 9:32 AM
# re: Updated Northwind Demo For ASP.NET MVC Preview 3
@Steve thanks for figuring it out. Not sure why that would happen.
Requesting Gravatar... Steve May 28, 2008 11:25 AM
# re: Updated Northwind Demo For ASP.NET MVC Preview 3
I think have a reason now: Resharper. I suspect that is the problem. One step I did that I later recalled while troubleshooting was that I turned off the add-in.

When Resharper starts, it loads the assemblies. I have a feeling it was still using the older version (My guess)
Requesting Gravatar... Vishal Bharakhda May 28, 2008 3:05 PM
# re: Updated Northwind Demo For ASP.NET MVC Preview 3
Please could someone help me on how to get rid of the error message that has been mentioned above.

The error is: Could not load file or assembly 'System.Web.Mvc' or one of its dependencies. Strong name signature could not be verified. The assembly may have been tampered with, or it was delay signed but not fully signed with the correct private key. (Exception from HRESULT: 0x80131045)

I have no idea how to fix this please could someone explain it in clear steps. (as in how do i rereference the assemblies?)

Much appreciated
Vishal
Requesting Gravatar... Steve May 28, 2008 6:27 PM
# re: Updated Northwind Demo For ASP.NET MVC Preview 3
Has the need for .mvc still exist with preview 3 ?
Requesting Gravatar... Angel May 29, 2008 7:58 AM
# re: Updated Northwind Demo For ASP.NET MVC Preview 3
Hi there, what versions are you using in the demo? are these the sames that are in the folder dependencies?, Thanks!
Requesting Gravatar... Haacked May 29, 2008 11:11 AM
# re: Updated Northwind Demo For ASP.NET MVC Preview 3
Hi All, I'm at a conference so it's hard for me to have time to fix the demo. It looks like Steve was able to. I'll fix it this Friday. Sorry.

Requesting Gravatar... Bart Plasmeijer May 30, 2008 12:49 AM
# re: Updated Northwind Demo For ASP.NET MVC Preview 3
Update the references in northwinddemo\dependecies and the sample will work!

System.Web.Abstractions
System.Web.Mvc
System.Web.Routing
Requesting Gravatar... Ahtesham May 30, 2008 2:39 AM
# re: Updated Northwind Demo For ASP.NET MVC Preview 3
hey every one ,
its strange question but i think i should ask cuz it could help other , i am new in MVC and i am using VS 2008 and MVC3
when i downloaded this code and when i build it after updating the refrence and when i start debugging the programe i get this error
that on default page ; is missing and there was only one line
<% Response.Redirect("~/Products/")%>
so i put ; after this
<% Response.Redirect("~/Products/");%>
and it start working
is this the error or did i do wrong thing i am lil confused , can some one explain me that
Requesting Gravatar... Haacked May 30, 2008 2:55 PM
# re: Updated Northwind Demo For ASP.NET MVC Preview 3
Hi All, I updated the Northwind sample. Bart hit upon the solution. I just removed project references and then re-added them. THis is what happens when I re-use an older project and just copy new DLLs in there. Sorry about that.
Requesting Gravatar... Lee May 31, 2008 1:44 AM
# re: Updated Northwind Demo For ASP.NET MVC Preview 3
When is MVC going to become 'official' as sorts.. I have noticed theres an MVC Unleashed book coming out in August, so is that the timescale you are looking at??
Requesting Gravatar... Haacked May 31, 2008 11:56 AM
# re: Updated Northwind Demo For ASP.NET MVC Preview 3
We haven't announced any release dates. Probably closer to the fall.
Requesting Gravatar... Dale Jun 01, 2008 6:31 PM
# re: Updated Northwind Demo For ASP.NET MVC Preview 3
Server Error in '/' Application.
--------------------------------------------------------------------------------

Could not load file or assembly 'System.Web.Mvc' or one of its dependencies. Strong name signature could not be verified. The assembly may have been tampered with, or it was delay signed but not fully signed with the correct private key. (Exception from HRESULT: 0x80131045)
Requesting Gravatar... Chenzidian Jun 02, 2008 8:24 PM
# re: Updated Northwind Demo For ASP.NET MVC Preview 3
error ! The error is: Could not load file or assembly 'System.Web.Mvc' or one of its dependencies.
Why Updated ?
Requesting Gravatar... rob Jun 05, 2008 6:59 AM
# re: Updated Northwind Demo For ASP.NET MVC Preview 3
can you reupload the demo, errors everywhere
Requesting Gravatar... Katrien Jun 10, 2008 3:06 AM
# re: Updated Northwind Demo For ASP.NET MVC Preview 3
Same issue as most folks here: removing the three references and then re-adding them by pointing to the ASP.NET MVC install path in Program Files solves it. Everything is working fine at my end.
Requesting Gravatar... Mike Jun 11, 2008 4:47 AM
# re: Updated Northwind Demo For ASP.NET MVC Preview 3
Project file is borked:

---------------------------
Microsoft Visual Studio
---------------------------
The project file 'D:\NorthwindDemo\NorthwindDemo.csproj' cannot be opened.

The project type is not supported by this installation.
Requesting Gravatar... haacked Jun 13, 2008 4:00 PM
# re: Updated Northwind Demo For ASP.NET MVC Preview 3
Try it one last time. I just updated the download.
Requesting Gravatar... indiekiduk Jun 20, 2008 8:36 AM
# re: Updated Northwind Demo For ASP.NET MVC Preview 3
Sorry forgot the code tag in above post.

[code]
Found a few bugs:

For the images to be relative path you need this:

When running on IIS this hard coded path int ListingByCategory.aspx will break it for two reasons - the path not being relative for when in a sub folder and also when the .mvc is needed:
<%=product.ProductName %>
Change it to:
<%=Html.ActionLink(product.ProductName, "Detail", new { ID=product.ProductID })%>

The Grains/Cereals and Meat/Poultry product links crash it because they have slashes in the generated URLs. How can you fix that? This is the problematic line:
<%= Html.ActionLink(category.CategoryName, "List", new { id=category.CategoryName })%>
[/code]
Requesting Gravatar... wind~~ Jun 25, 2008 12:40 AM
# re: Updated Northwind Demo For ASP.NET MVC Preview 3
to indiekiduk:

Categories.aspx:
<%= Html.ActionLink(category.CategoryName, "List", new { id=category.CategoryName.Replace("/", "@") })%>

ProductsController.cs:
id = id.Replace("@", "/");
Requesting Gravatar... Alan Jul 12, 2008 6:18 AM
# re: Updated Northwind Demo For ASP.NET MVC Preview 3
Worked a treat, no problem's ;-)
Requesting Gravatar... James Jul 17, 2008 9:04 AM
# re: Updated Northwind Demo For ASP.NET MVC Preview 3
love the demo, really helping me with taking all of the grunt work out of the code behind that im so used to using. Only question that I have is:

Is using forms the best/only approach for passing information back to the controller for updating purposes?

Thanks,
James
Requesting Gravatar... Kris Krause Aug 01, 2008 8:04 AM
# re: Updated Northwind Demo For ASP.NET MVC Preview 3
Johan,

You are correct. The CanUpdateProduct and CanEditProduct unit tests fail... everything else seems to be okay.

For the CanUpdateProduct test you need to add:

formVars.Add("UnitPrice", "3.01");

For the CanEditProduct unit test you need to Mock the TempDataDictionary. Apparently, this following code is not doing the job... so I need to do more research.

var context = new Mock();
controller.TempData = new TempDataDictionary(context);



Requesting Gravatar... Kris Krause Aug 01, 2008 8:11 AM
# re: Updated Northwind Demo For ASP.NET MVC Preview 3
Looks like we can wait until Preview 4 is released:

mhinze.com/testing-tempdata-in-aspnet-mvc-previ...
Requesting Gravatar... Bruce Sinner Aug 25, 2008 12:47 AM
# re: Updated Northwind Demo For ASP.NET MVC Preview 3
Hi,

I downloaded the demo and when I try to access the controller method "/Products/New" its giving me the following error:

CS1061: 'System.Web.Mvc.ViewDataDictionary' does not contain a definition for 'Categories' and no extension method 'Categories' accepting a first argument of type 'System.Web.Mvc.ViewDataDictionary' could be found (are you missing a using directive or an assembly reference?)

I'm using ASP.NET MVC Preview 4, does anyone have an idea what it may be ?

thanks
Requesting Gravatar... svolegov Aug 28, 2008 8:11 AM
# re: Updated Northwind Demo For ASP.NET MVC Preview 3
Sheesh, take down animated ads. They totally ruin reading

What do you have to say?

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