introduction to asp.net mvc3 & mvc4 by: chad w. stoker (mcts, mcp, mcad) president & chief...

12
Introduction to ASP.NET MVC3 & MVC4 By: Chad W. Stoker (MCTS, MCP, MCAD) President & Chief Technology Officer

Upload: maud-bates

Post on 04-Jan-2016

227 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Introduction to ASP.NET MVC3 & MVC4 By: Chad W. Stoker (MCTS, MCP, MCAD) President & Chief Technology Officer

Introduction to ASP.NET MVC3 & MVC4

By: Chad W. Stoker (MCTS, MCP, MCAD)President & Chief Technology Officer

Page 2: Introduction to ASP.NET MVC3 & MVC4 By: Chad W. Stoker (MCTS, MCP, MCAD) President & Chief Technology Officer

ASP.NET MVC Lifecyce

Page 3: Introduction to ASP.NET MVC3 & MVC4 By: Chad W. Stoker (MCTS, MCP, MCAD) President & Chief Technology Officer

Reminder: Quick Security

Setting up an ASP.NET Security db model is as simple as : aspnet_regsql

There are different options…

I’ll use: aspnet_regsql –S . –E –d MVCMadness –A mr

Page 4: Introduction to ASP.NET MVC3 & MVC4 By: Chad W. Stoker (MCTS, MCP, MCAD) President & Chief Technology Officer

Starting Out w/ ASP.NET Classic

How to turn this:

Into THIS!

Page 5: Introduction to ASP.NET MVC3 & MVC4 By: Chad W. Stoker (MCTS, MCP, MCAD) President & Chief Technology Officer

Little gotcha w/ ASP.NET MVC4 RC

If you run into a problem like: The type 'System.Web.Mvc.ModelClientValidationRule' exists in both 'C:\Program Files (x86)\Microsoft ASP.NET\ASP.NET Web Pages\v2.0\Assemblies\System.Web.WebPages.dll' and 'c:\Program Files (x86)\Microsoft ASP.NET\ASP.NET MVC 3\Assemblies\System.Web.Mvc.dll

◦Find this in your *.csproj file…<Reference Include="System.Web.WebPages/>

◦Replace with: <Reference Include="System.Web.WebPages, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL "/>

Page 6: Introduction to ASP.NET MVC3 & MVC4 By: Chad W. Stoker (MCTS, MCP, MCAD) President & Chief Technology Officer

And more ASP.NET MVC4 gotchas!

◦Find this in your *.csproj file…<Reference Include="System.Web.Helpers/>

◦Replace with: <Reference Include="System.Web.Helpers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL "/>

Also, add this to your Web.config’s appSettings node, and reload the CSPROJ file.

See: ASP.NET MVC4 Release Notes for more

Page 8: Introduction to ASP.NET MVC3 & MVC4 By: Chad W. Stoker (MCTS, MCP, MCAD) President & Chief Technology Officer

Accessing RoutingData

From ASPX Forms… use Page.RouteData[]From MVC views… use

@Url.RequestContext.RouteDataFrom MVC controllers… use RouteData[]

More at:http://www.codeguru.com/csharp/article.php/c18645/MVC3-Routing.htm

Page 9: Introduction to ASP.NET MVC3 & MVC4 By: Chad W. Stoker (MCTS, MCP, MCAD) President & Chief Technology Officer

Working w/ Partial-Views

@Html.Partial(“”) in viewsreturn PartialView(); in controllers

Can dynamically generate HTML content with Jquery script…

Can override the View-Engine to make searching for your specific folder structure simple!

Page 10: Introduction to ASP.NET MVC3 & MVC4 By: Chad W. Stoker (MCTS, MCP, MCAD) President & Chief Technology Officer

Working w/ Simple DataBinding

This is not about how to use Knockout.js… yet.

HTML Helpers.

ModelBinder and what it does…

Good use of Error Partial-View concept…

Page 11: Introduction to ASP.NET MVC3 & MVC4 By: Chad W. Stoker (MCTS, MCP, MCAD) President & Chief Technology Officer

Overriding Security… for SAW?

Page 12: Introduction to ASP.NET MVC3 & MVC4 By: Chad W. Stoker (MCTS, MCP, MCAD) President & Chief Technology Officer

ASP.NET MVC4… the WebAPI

Now you can do WCF with MVC… seriously.