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
130
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
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
RAG の “R” を Swift で覗いてみる 〜「意味から探す」検索の仕組み〜
nao_randd
0
160
Starting & Sustaining Code-Based E2E Testing for Non-Coding QA Teams( #jasstniigata )
teyamagu
PRO
1
1k
Event is what happens
moro
2
810
動作中のプログラムの中身をリアルタイムに覗く / Realtime Debugger for CSharp with Roslyn
prota
1
1.9k
コーディング自動化の次へ。人の介入をゼロにするファクトリーとサポートAIによる実践
timakin
5
3.7k
パズルゲームの作り方 / how to make puzzle games
kaityo256
PRO
2
290
Long Living Tokens, Die, Die, Die! (or: The One Ring is Banned in Modern)
sylph01
0
310
Findy - エンジニア向け会社紹介/Findy Company Deck
findyinc
6
400k
Kotlinの15年とServer-Side Kotlin
n_takehata
1
150
APNsからLive Activityを開始する話
yumnumm
0
170
Workers Cache を知る
syumai
0
370
[Dev Group Paris Octobre 26] Agentforce, SIforce, Claudeforce, Slackbot… on s'y retrouve ?
nabondance
0
110
Featured
See All Featured
Unlocking the hidden potential of vector embeddings in international SEO
frankvandijk
0
990
Breaking role norms: Why Content Design is so much more than writing copy - Taylor Woolridge
uxyall
1
450
Music & Morning Musume
bryan
48
7.4k
Imperfection Machines: The Place of Print at Facebook
scottboms
270
14k
Getting science done with accelerated Python computing platforms
jacobtomlinson
2
540
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
31
10k
End of SEO as We Know It (SMX Advanced Version)
ipullrank
3
4.4k
Facilitating Awesome Meetings
lara
57
7.2k
The SEO Collaboration Effect
kristinabergwall1
1
590
ReactJS: Keep Simple. Everything can be a component!
pedronauck
666
130k
The AI Search Optimization Roadmap by Aleyda Solis
aleyda
2
6.3k
Cheating the UX When There Is Nothing More to Optimize - PixelPioneers
stephaniewalter
287
14k
Transcript
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