Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
ASP.NET MVC - Beyond "WTF is a controller?"
Search
Philip Proplesch
December 06, 2013
Programming
140
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
ASP.NET MVC - Beyond "WTF is a controller?"
Philip Proplesch
December 06, 2013
Transcript
34 slides
None
None
None
• • • • • • •
public ActionResult Login(LoginViewModel model) { if (!ModelState.IsValid) { return View(model);
} // … }
public static void RegisterBundles(BundleCollection bundles) { // ... bundles.Add(new ScriptBundle("~/bundles/jqueryval").Include(
"~/Scripts/jquery.validate*")); // ... }
None
[Authorize] public ActionResult Index() { return View(); }
[Authorize(Roles = "Administrators")] public ActionResult Index() { return View(); }
[Authorize(Users = "John Doe, Max Mustermann")] public ActionResult Index() {
return View(); }
[RequireHttps] public ActionResult Index() { return View(); }
None
• IAuthorizationFilter • IActionFilter • IResultFilter • IExceptionFilter
public class FooBarAttribute : ActionFilterAttribute { public override void OnActionExecuting(ActionExecutingContext
filterContext) { } public override void OnActionExecuted(ActionExecutedContext filterContext) { } }
[FooBar] public ActionResult Create() { return View(); }
public static void RegisterGlobalFilters(GlobalFilterCollection filters) { filters.Add(new FooBarAttribute()); }
None
[Display(ResourceType = typeof(Labels), Name = "UserName")] public string UserName {
get; set; } [Display(ResourceType = typeof(Labels), Name = "Password")] public string Password { get; set; }
routes.MapRoute( name: "Default", url: "{language}/{controller}/{action}/{id}", defaults: new { language =
"en", controller = "Home", action = "Index", id = UrlParameter.Optional } );
None
public static void RegisterRoutes(RouteCollection routes) { routes.MapMvcAttributeRoutes(); }
[RoutePrefix("products")] public class ProductController : Controller { [Route("all")] public ActionResult
List() { } [Route("{slug}")] public ActionResult Details(string slug) { } [Route("{slug}/reviews")] public ActionResult Reviews(string slug) { } }
• • • • • • •
IRouteConstraint var constraints = new DefaultInlineConstraintResolver(); constraints.ConstraintMap.Add("foo", typeof(FooConstraint)); routes.MapMvcAttributeRoutes(constraints);
None
ValueProvider
DefaultModelBinder [HttpPost] public ActionResult Create(CreateUserViewModel model) { return View(); }
public class FooModelBinder : IModelBinder { public object BindModel( ControllerContext
controllerContext, ModelBindingContext bindingContext) { // ... } }
[HttpPost] public ActionResult DoSomething( [ModelBinder(typeof(FooModelBinder))] Foo model) { return View();
}
None
• •
protected void Application_Start() { ViewEngines.Engines.Clear(); ViewEngines.Engines.Add(new RazorViewEngine()); }
[OutputCache(Duration = 600)] public ActionResult Index() { return View(); }
None
More Decks by Philip Proplesch
See All by Philip Proplesch
OWIN & ASP.NET vNext
philipproplesch
1
190
Getting started with ServiceStack
philipproplesch
1
110
Other Decks in Programming
See All in Programming
祈るテストから、探索するテストへ 〜Lincheckではじめる並行処理テスト〜
yyh_gl
0
440
地方こそサーバーレス — 10年続けた、顔が見えるチームで確かな基盤を / Serverless Matters Most in Regional Areas — 10 Years of Building Reliable Foundations with Close-Knit Teams
seike460
PRO
2
520
Agentic AI with the Power of Jakarta EE
ivargrimstad
0
240
高速開発を止めずに 性能を上げる Flyleのシステム刷新と改善の歴史
azihsoyn
0
110
はじめてのPLATEAU
nokonoko1203
1
680
Claude Codeのおかげでやりたいことがやれるようになったんだよォー!
sms_tech
0
190
느린 네트워크와 저사양 디바이스 사용자를 위한 웹뷰 로딩 시간 개선기
kmkim
1
280
ビジネスロジックを堅牢に~Scala 3のドメインプリミティブ~
j5ik2o
0
240
선언형 햅틱 라이브러리 진동을 소개합니다
l2hyunwoo
1
330
Claude Code ハーネスDeep Dive – 君はどこまで制御する? -
takateeen_knj
6
6.4k
AppFunctionsの内部実装を紐解く
hiroaki404
1
130
[DroidKnights 2026] Workflow AX: From Auto-Documented Policies to E2E Testing
raeminkang
0
620
Featured
See All Featured
The State of eCommerce SEO: How to Win in Today's Products SERPs - #SEOweek
aleyda
2
12k
Building a Scalable Design System with Sketch
lauravandoore
464
34k
Improving Core Web Vitals using Speculation Rules API
sergeychernyshev
21
1.7k
ピンチをチャンスに:未来をつくるプロダクトロードマップ #pmconf2020
aki_iinuma
128
56k
VelocityConf: Rendering Performance Case Studies
addyosmani
331
25k
Building Experiences: Design Systems, User Experience, and Full Site Editing
marktimemedia
1
680
The Impact of AI in SEO - AI Overviews June 2024 Edition
aleyda
6
1.3k
How STYLIGHT went responsive
nonsquared
100
6.4k
Data-driven link building: lessons from a $708K investment (BrightonSEO talk)
szymonslowik
1
1.5k
The Web Performance Landscape in 2024 [PerfNow 2024]
tammyeverts
12
1.4k
The Director’s Chair: Orchestrating AI for Truly Effective Learning
tmiket
1
370
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
52
6.2k