ASP.Net MVC Word Scramble
|
Embed Code - If you would like this activity on your web page, copy the script below and paste it into your web page.
Normal Size Small Size show me how
Normal Size Small Size show me how
Question | Answer |
Webforms vs. MVC | 1. Webforms: url = page; MVC: url=controller action. 2. Webforms: content-centric; MVC: logic centric |
URL Routing | routes incoming requests to controller actions |
Route Table Creation | Application_Start() method calls the RegisterRoutes() method and the RegisterRoutes() method creates the default route table. |
default route | breaks all incoming requests into three segments: controller name, action name, and a parameter passed to the action named Id. |
default route default values | The default Controller is HomeController, the default Action is Index, and the default Id is an empty string |
controller | determines what response to send back to a user when a user makes a browser request; must contain suffix -Controller |
action | public method on a controller |
view | contains HTML and markup to be sent to the browser |
view location | controller views must be located in \Views\[Controller Name]\[Action Name].aspx |
controller requirements | 1. must contain suffix -Controller, 2. must reside in \Controllers folder 3. must reference System.Web.Mvc and System.Web.Mvc.Ajax, 4. must inherit from controller class |
action requirements | 1. must be public, 2. cannot be overloaded, 3. cannot be shared |
six action results | 1. ViewResult: HTML and markup. 2. EmptyResult:no result. 3. RedirectResult: redirection to a new URL 4. RedirectToRouteResult: redirection to a new controller action 5. JsonResult: a JavaScript Object Notation 6. ContentResult – plain text. |
6 result return methods | View,Redirect,RedirectToAction,RedirectToRoute,Json,Content |
<%= %> | shortcut for Response.Write() |
HTML Helper | method that generates a string |
ViewData property | a collection of name and value pairs used to pass data from a controller to a view |
Html.Encode() | HTML Helper encodes special characters such as < and > into characters that are safe to display in a web page |
4 web.config sections for URL Routing | system.web.httpModules section, system.web.httpHandlers section, system.webserver.modules section, and system.webserver.handlers |
custom route requirements | custom routes should be added before default routes |
2 ways to prevent Javascript injection attacks | 1. Encode the view, 2. Encode the controller |
HTML Encoding in View | <%=Html.Encode([text])%> |
HTML Encoding the Controller | Server.HtmlEncode([text]) |
model binder | allow you to map incoming form post values to complex .NET types passed as Controller action method parameters |
Created by:
jhlee5
Popular Computers sets