Programming Microsoft ASP.NET MVC Flashcards Preview

Programming Microsoft ASP.NET MVC > Programming Microsoft ASP.NET MVC > Flashcards

Flashcards in Programming Microsoft ASP.NET MVC Deck (23)
Loading flashcards...
1

ASP

Active Server Page

2

Razor Syntax Rules for C#

  • Razor code blocks are enclosed in @{ ... }
  • Inline expressions (variables and functions) start with @
  • Code statements end with semicolon
  • Variables are declared with the var keyword
  • Strings are enclosed with quotation marks
  • C# code is case sensitive
  • C# files have the extension .cshtml

3

Main Razor Syntax Rules for VB

  • Razor code blocks are enclosed in @Code ... End Code
  • Inline expressions (variables and functions) start with @
  • Variables are declared with the Dim keyword
  • Strings are enclosed with quotation marks
  • VB code is not case sensitive
  • VB files have the extension .vbhtml

4

The root on a disk drive C:\ (backwark slash)

The root on a web site is  / (forward slash).

5

~ Operator

Virtual root in programming code

6

Server.MapPath Method

The Server.MapPath method converts a virtual path (/default.cshtml) to a physical path that the server can understand

7

  • href
  • RenderBody()
  • RenderPage(page)
  • RenderSection(section)
  • Write(object)
  • WriteLiteral

  • Builds a URL using the specified parameters
  • Renders the portion of a content page that is not within a named section (In layout pages)
  • Renders the content of one page within another page
  • Renders the content of a named section (In layout pages)
  • Writes the object as an HTML-encoded string
  • Writes an object without HTML-encoding it first.

8

  • IsPost
  • Layout
  • Page
  • Request
  • Server

  • Returns true if the HTTP data transfer method used by the client is a POST request
  • Gets or sets the path of a layout page
  • Provides property-like access to data shared between pages and layout pages
  • Gets the HttpRequest object for the current HTTP request
  • Gets the HttpServerUtility object that provides web-page processing methods

9

 

non-breaking space

10

MVC

  • Models: Classes that represent the data of the application  and that use validation logic to enforce business rules for that data
  • Views: Template files that your application uses to dynamically  generate HTML responses
  • Controllers: Classes that handle incoming browser requests,  retrieve model data, and then specify view templates that return a response  to the browser

11

IDE

Integrated development environment

12

Default MVC URL

/[Controller]/[ActionName]/[Parameters]

13

C# optional-parameter

  • function ( x = 1 )
  • = 1 is optional

14

  • &
  • ?

  • The & character separates query strings
  • The ? character separates the URL and query strings

15

EF

  • Entity Framework
  • Use for accessing data

16

Visual Studio automatically created the CRUD  action methods and views

(create, read, update, and delete)

17

@Html.ActionLink("Edit", "Edit", new { id=item.ID })
 

  • The first argument to the ActionLink method is the link text to render
  • The second argument is the name of the action method to invoke
  • The final argument is an anonymous object that generates the route data

18

 HttpPost attribute
[HttpPost]
 

This attribute specifies that that overload of the Edit method can be invoked only for POST requests

19

Bind attribute
public ActionResult Edit([Bind()] ) 
 

The Bind attribute is an important security mechanism that keeps hackers from over-posting data to your model

20

ModelState.IsValid method 

Verifies that the data submitted in the form can be used to modify (edit or update) an object

21

Html.ValidationMessageFor

 The Html.ValidationMessageFor helpers in the Edit.cshtml view template take care of displaying appropriate error messages.

22

LINQ

Language-Integrated Query

23

The s => s.Title code

Lambda Expression used in method-based LINQ queries  as arguments to standard query operator methods