MCTS Tutorial 1

Client-Server

In client server architecture,

Client is a frond-end user interface, which is responsible for accepting input from the user and sending this input to the server for processing.
Server is a back-end, which is responsible for responding to the requests from the client.

The web browser (client) and the web server communicate by using HTTP at TCP port number 80.

If the server has a certificate installed then the client-server can use HTTPS to communicate with each other. Here TCP port number 443 will be used by default.

Request and Response

In ASP.NET, communication from a web browser to a web server is termed as a Request, and communication from web server back to the web browser is termed as a Response.

Status Codes

Status Code
100 : – Continue
200 : – Ok
201 : – Created
300 : – Multiple Choices
301 : – Moved Permanently
302 : – Found
400 : – Bad Request
401 :- Unauthorized
403 :- Forbidden
404 :- Not Found
407 :- Proxy Authentication Required
408 :- Request Timed Out
413 :- Request Entity Too Large
500 :- Internal Server Error
501 :- Not Implemented

GET v/s POST methods

There are 2 HTTP commands that can be used to submit the form data to the web server.

GET:
When GET method is used, the form data will be appended to the URL as a query string.
Example: www.shahvaibhav.com/example.aspx?name=vaibhav&color=orange
The query string will be appended after a question mark (?) as a name-value pair, where each pair is separated by an ampersand character (&).
Disadvantages: – Not Secure, Limited Length (1024 IIS, 2083 in IE).

POST:
When POST command is used data is placed into the body section of the request.
The content is sent as name-value pairs but here it is not made visible in the address bar of the browser.
No restriction on the length of the string.


Q. In which location does Visual Studio create solution files by default?

Ans: C:\Users\user.name\Documents\Visual Studio 2010\Projects

ASP.NET Configuration

Using features provided by ASP.NET configuration you can configure…
All ASP.NET applications on an entire server
A single ASP.NET application
An Individual Page
Sub-Directories

The features that we can configure using this include authentication modes, caching settings, custom errors, compiler options, debug and trace options etc…

These files have an extension of .config

A single site can be configured by using multiple .config files.

Configuration settings can be defined at 5 different levels in the hierarchy as shown below

1. Global Machine(Machine.Config)
“%SystemRoot%\Microsoft.NET\Framework\\CONFIG\”
The machine.config file will contain settings that apply to an entire computer
There is only one machine.config file on a computer
The Machine.config file contains settings for all .NET application types, such as Windows, Console, Class Library, and Web applications.

2. Web.config
Located in the same folder as Machine.config file.
It is used to change settings for all websites on a computer. It will override settings defined in Machine.config.

3. Website
To change settings of an individual website, site specific web.config file is used.
This file is located in website’s root folder.

4. Web Application
Overrides settings defined in Website’s web.config file

5. Folder
Overrides settings defined in Web App’s web.config file

Websites are configured based on a hierarchy of configuration files, starting with the Machine.config file, followed by the Web.config file which is defined in the same folder. After that, you might have a Web.config file in the root of the website, then in each web application, and further in any subdirectory of the web application.

You can restrict the inheritance by using the allowOverride, lockAttributes, lockAllAttributesExcept, lockAllElementsExcept, lockItem and lockElements attributes.

WSAT is used to add and modify the website settings.

admin

UncommonLife