70-513 Chapter 1 - Lesson 1

Réussis tes devoirs et examens dès maintenant avec Quizwiz!

5xx

Server Error: The server failed to fulfill a request that appears to be valid.

"1. From within an ASP.NET page, you need to run a section of code only if the user has previously loaded the page and is submitting data as part of a form. Which Page object property should you use? A. IsCallback B. IsReusable C. IsValid D. IsPostBack"

"1. Correct Answer: D A. Incorrect: IsCallback is generated by client-side scripts and does not involve reloading a page. B. Incorrect: IsReusable is a standard property that indicates whether an object can be reused. C. Incorrect: IsValid indicates whether page validation succeeded. IsValid is discussed in more detail in Chapter 5, "Input Validation and Site Navigation." D. Correct: If IsPostBack is true, the page loading is the result of a form being submitted by the user. IsPostBack is discussed in more detail in Chapter 5."

"2. You are troubleshooting a problem users have when submitting information with a form. The form data does not appear in the web browser's address bar, but you know the web server is receiving the form data. After capturing the web communications with a sniffer, which type of HTTP request should you examine to see the data the user submitted? A. PUT B. CONNECT C. POST D. GET"

"2. Correct Answer: C A. Incorrect: The PUT command is used to add a file to a web server. B. Incorrect: The CONNECT command is not frequently used. It is reserved for use with proxy servers under very specific conditions. C. Correct: The POST command is used when a browser submits the results of a form. The form data is stored as part of the response packet. D. Incorrect: The GET command is used to submit a form with the form data included as part of the URI."

"The HTML <form> tag can be used to create a webpage that collects data from the user and sends the collected data back to the web server. The form tag is nested inside the <HTML> tags. The form tags typically include information for the user in the form of text, and input tags for defining controls such as buttons and text boxes. A typical use of the <form> tag might look like the following."

"<form method=""POST"" action=""getCustomer.aspx""> Enter Customer ID: <input type=""text"" name=""Id""> <input type=""submit"" value=""Get Customer""> </form>"

PUT

"Allows a client to directly create a resource at the indicated URL on the server. If the user has permission, the server takes the body of the request, creates the file specified in the URL, and copies the received data to the newly created file."

audio

"Audio data. Requires an audio output device (such as a speaker or headphones) for the contents to be heard. An initial subtype, basic, is defined for this type."

4xx

"Client Error: The request has a syntax error or the server does not know how to fulfill the request."

What Is Distributed Authoring and Versioning?

"Distributed Authoring and Versioning (DAV) is a set of extensions to HTTP/1.1 that simplifies website development when work is being carried out in a team scenario. DAV is an open standard and is available on numerous platforms. DAV provides the ability to lock and unlock files and the ability to designate versions. DAV is built directly on HTTP/1.1, so no other protocols, such as File Transfer Protocol (FTP) or Server Message Block (SMB), are required. DAV also provides the ability to query the web server for various resource properties such as file names, time stamps, and sizes. DAV also gives developers the ability to perform server-side file copying and moving. For example, you can use the HTTP GET and PUT commands to retrieve files from the web servers and save them to different locations, or you can use DAV's COPY command to tell a server to copy a file."

GET

"Gets an object, such as a webpage, from the server. A GET request for a specific URL (Uniform Resource Locator) retrieves the resource. For example, GET /test.htm retrieves the test.htm resource (typically a static file, but it could be generated dynamically)."

HTTP

"HTTP is a text-based communication protocol that is used to request webpages from a web server and send responses back to a web browser. When a webpage is requested, the browser sends a request to the web server. The request might look like the following. GET /default.aspx HTTP/1.1 Host: www.northwindtraders.com"

image

"Image data. Subtypes are defined for two widely used image formats, jpeg and gif, and other subtypes exist as well."

"GET /getCustomer.aspx?Id=123&color=blue HTTP/1.1 Host: www.northwindtraders.com"

"In this example, a GET request is made to the web server for a webpage called getCustomer.aspx on the root of the website (indicated by the forward slash). The query string contains the form data following the question mark (?)."

1xx

"Informational: The request was received, and the server is continuing to process."

CONNECT

"Reserved for use with a proxy that can dynamically switch to being a tunnel, such as with the SSL protocol."

HEAD

"Retrieves the meta information for an object without downloading the page itself. HEAD is typically used to verify that a resource hasn't changed since the browser cached it."

POST

"Sends data to the web server for processing. This is typically what happens when users enter data on a form and submit that data as part of their request, but it has other meanings when used outside the bounds of HTML forms."

DEBUG

"Starts ASP.NET debugging. This command informs Visual Studio of the process to which the debugger will attach."

"In ASP.NET, what does the Request object represent? "

"The Request object in ASP.NET wraps the communication from the web browser to the web server. "

In ASP.NET, what does the Response object represent?

"The Response object in ASP.NET wraps the communication from the web server to the web browser."

REQUEST

"The communication from the web browser to the web server is referred to as a request. In ASP.NET, there is a Request object that is used to represent the web browser's communications to the web server. ASP.NET wraps the resource request in an object that can be queried in code. By wrapping the HTTP request in a programmable object, ASP.NET provides your code access to things such as the cookies associated with your site, the query string parameters passed with the URL, and the path to the requested resource, and allows you to work with other relevant request-based information."

RESPONSE

"The communication from the web server back to the web browser is wrapped in the Response object. You can use this object to set cookies, define caching, set page expiration, and more. When a web server responds to a request, it uses what it finds in the Response object to write the actual, text-based HTTP response, such as the following. HTTP/1.1 200 OK Server: Microsoft-IIS/6.0 Content-Type: text/html Content-Length: 38 <html><body>Hello, world.</body><html>"

"GET /default.aspx HTTP/1.1 Host: www.northwindtraders.com"

"The first word in the request is the command, often known as the method. In this case, the command is GET. The command is followed by the Uniform Resource Identifier (URI) of the resource to be retrieved. In this case, the URI is /default.aspx. Following the URI is the version of HTTP to be used to process the command. In this case, the HTTP version is HTTP/1.1. The second line of the request (Host: www.northwindtraders.com) identifies the name of the website. Most web servers host multiple websites with a single IP address, and need to know the website's name to return the correct page. This process involves using host headers to identify the website that will handle the request."

"HTTP/1.1 200 OK Server: Microsoft-IIS/6.0 Content-Type: text/html Content-Length: 38 <html><body>Hello, world.</body><html>"

"The next line is content length (Content-Length: 38 in this example). This simply indicates the size of the content (in "octets," or 8-bit bytes) that follows. After the Content-Length line, the response message is returned. The browser attempts to process the content based on its MIME type. For example, it interprets HTML for HTML MIME types and shows a picture for image MIME types."

"HTTP/1.1 200 OK Server: Microsoft-IIS/6.0 Content-Type: text/html Content-Length: 38 <html><body>Hello, world.</body><html>"

"The second line of the response indicates the type of web server (Server: Microsoft-IIS/6.0). The third line (Content-Type) indicates the type of resource that is being sent to the web browser as part of the response. This indicator is in the form of a Multipurpose Internet Mail Extensions (MIME) type. In this example (Content-Type: text/html), the file is an HTML text file. The MIME type is a two-part designator that is shown as type/subtype, in which the first part is the resource type (text, in this example) and the second part is the resource subtype (html, in this example). Some common MIME types are shown in Table 1-4."

Real World

"There's no better way to understand HTTP than to watch your own web browser's inner workings as you surf. Though you can find several free sniffer applications on the web, my favorite is Microsoft Network Monitor (available from http://www.microsoft.com/downloads). You can also purchase several browser add-ons that monitor HTTP within your browser session, including HttpWatch from http://www.httpwatch.com/ and Fiddler from http://www.fiddler2.com/."

"When the GET command is used to send data to the server, the complete URL and query string can be seen and modified in the address bar of the web browser, as shown in Figure 1-1."

"This allows users to easily bookmark or link to the results of the form, which is important for search pages. However, it's not a good choice for authentication pages, because the user's credentials would be visible in the URL. It's also not a good choice when the user needs to transfer large amounts of information, because when Windows Internet Explorer and Internet Information Services (IIS) are used, the limit for a query string is 1,024 characters (other browsers and server implementations also have limitations, although they might not limit the length to the values IIS and Internet Explorer use). Figure 1-1 Returning form results by using a GET request shows the input in the address bar."

"<form method=""POST"" action=""getCustomer.aspx""> Enter Customer ID: <input type=""text"" name=""Id""> <input type=""submit"" value=""Get Customer""> </form>"

"This example form prompts the user for a customer ID, displays a text box that collects the desired customer ID, and also displays a Submit button that initiates the sending of data to the web server. The method attribute of the form tag indicates the HTTP command (POST) to use when sending the request to the server. The action attribute is the relative URL of the page to which the request will be sent."

OPTIONS

"Used by client applications to request a list of all supported commands. You can use OPTIONS to check to see if a server allows a particular command, thus avoiding wasting network bandwidth trying to send an unsupported request."

TRACE

"Used for testing or diagnostics; allows the client to see what is being received at the other end of the request chain."

"The POST command is a better choice for submitting credentials and large amounts of data. When the POST command is used, the data is placed into the message body of the request as follows. POST /getCustomer.aspx HTTP/1.1 Host: www.northwindtraders.com Id=123&color=blue"

"Using the POST command removes the input from the URL and overcomes size constraints. Instead, the data is hidden in the message body. Sending data back to the server as part of your request is often referred to as a postback in ASP.NET. Although its name comes from the POST command, it is possible to perform a postback by using the GET command already described. An ASP.NET webpage contains a property called IsPostBack that is used to determine if data is being sent back to the web server or if the webpage is simply being requested."

video

"Video data. The subtype mpeg is often used. Typically, videos are not transferred directly, but are read from an embedded object, such as a JavaScript or Adobe Flash object."

"There are two HTTP commands that can be used to submit the form data to the web server: GET and POST."

&quot;When the GET command is used, the form data is appended to the URL as part of the query string. The query string is a collection of key-value pairs, separated by an ampersand (&amp;) character. The start of the query string is indicated by a question mark (?). The following provides an example. GET /getCustomer.aspx?Id=123&amp;color=blue HTTP/1.1 Host: www.northwindtraders.com&quot;

"In addition to the status code groups, HTTP/1.1 defines unique status codes and reasons. A reason is nothing more than a very brief description of the status code. Table 1-3 shows a list of common status codes and reasons."

...

Common HTTP/1.1 Methods

...

Lesson Review

...

Submitting Form Data to the Web Server

...

Table 1-2 Status Code Groups

...

Table 1-4 Common MIME Types

...

Understanding the Role of HTTP

...

application

Any binary data. The subtype octet-stream is typically used.

400

Bad Request

100

Continue

201

Created

DELETE

Deletes a resource on the web server if the user has permission.

HTTP Method

Description

Status Code Groups

Descriptions

403

Forbidden

302

Found

"What protocol is used to communicate between the web browser and the web server?"

HTTP is used for web browser and web server communication.

500

Internal Server Error

301

Moved Permanent

300

Multiple Choices

404

Not Found

501

Not Implemented

200

Ok

407

Proxy Authentication Required

Status Code

Reason

3xx

Redirect Command: The client must access a different resource instead.

413

Request Entity Too Large

408

Request Time Out

2xx

Success: The action was successfully received, understood, and accepted.

text

Textual information. Subtypes include plain, html, and xml.

"HTTP/1.1 200 OK Server: Microsoft-IIS/6.0 Content-Type: text/html Content-Length: 38 <html><body>Hello, world.</body><html>"

The first line indicates the communication protocol and version information. It also includes the status code for the response and the reason that describes the status code. The status codes are three-digit numbers and are grouped as shown in Table 1-2.

401

Unauthorized


Ensembles d'études connexes

Research & Statistics-final exam

View Set

Chapter 15: Cancer Lewis: Medical-Surgical Nursing, 10th Edition

View Set

Topic 6: Biomes Biomes Dynamic Study Module

View Set

Chapter 15- Sexually Transmitted Infections

View Set