Introduction of HTTP and State management in ASP.NET

By
The Role of HTTP:-> Http is a stateless protocol. It is known as Hypertext Transfer protocol.It is used to send the client request to the web server.All the Browser such as google chrome ,Mozilla Firefox,Netscape and Internet Explorer are clients that helps to send a request to the web server.After verification of credentials,web server response the client's request through the HTTP protocol.


HTTP protocol does not maintain the state of data.When the web server disconnect then it does not maintain data ,It forget the previous interactions.To remember the specific information of web server ASP.NET provides numerous ways to handle the state information through the session variables,cookies and application variables.There are some other new technique that remember the state  as view state control state and cache.

The Web Server :-> A web server is a software that held your web application. A server which provides web services,is known as web server. There are some features are web server:-
  • Integrated security
  • File Transfer protocol ( FTP)
  • Mail Exchange Services  etc.
Example:- 
Microsoft IIS server is web server.It has intrinsic support for classic ASP as well as ASP.NET web applications.
Web Application:-> A web application is a collection of files(*.html,*.aspx,*.asp,image file jquery ,Database etc.).A web applications have a specific life cycle and provide numerous events.
A web application refers to status of  a web application at any instant of time preserving application.State ensures that the changes made by the user whenever page is reloaded.In this tutorial i will discuss different "states of web applications".State are categorised into several type such as: 
  • Application state
  • session state 
  • view state
That depends on the nature of information they preserve.We will Learn" Global.aspx"  file which is used to implement application-level and session level events. I will discuss this file with a real life example in next tutorial.
Structure of an Application:-> 
The structure of an ASP.NET Web Application includes the concepts of three structure.
  • Application Domain
  • Application Lifetime
  • Application Directory
1. ) Application Domain:-> An Application domain is actually implement by common language Run time( CLR) . The primary objective of  the application domain is to prevent concurrently running  applications from entering into each  others domain . Application domain provides an isolation boundary for application.The benefit of application is the independent execution of web applications.The main components that held in the independent execution of application in virtual directory.   
Some primary application entities that are stored in the virtual directory  are :-
  • Web page
  • Configuration files
  • Code-behind files
  • Global.asax file                                                          
2. ) The Application Lifetime:->  Application lifetime refers to the time span for which an application domain persists.
3. ) The Application Directory Structure:->An efficiently designed directory structure plays a key role in web application development.If application directory is efficient the we can used all code and resources among different directory without any problem.The advantage of using directory  structure is enhancing the reusability of an application.It becomes easy for you to upgrade the application in long period of time because of its code files and application resources.
ASP.NET 4.0 support a default directory structure which provides several built-in directories for web applications.
  • Bin
  • App_code
  • App_Global Resources
  • App_Local Resources
  • App_Web References
  • App_Data
  • App_Browsers
  • App_Themes
The Global.asax  Application File:-
The Global.asax file resides in the root directory of an ASP.NET Web application.Events Status,such  a session state and application are specified in the Global.asax file.
  • Difference between Global.asax file and web forms:-
The code within the Global.asax file does not contain HTML and ASP.NET tags instead, the code in this file contains methods with predefined names.
The various methods corresponding to the events that occurs in the Global.asax file which are given below:-
  • Begin Request()
  • Authenticate Request()
  • Authorize Request()
  • Resolve Request cache()
  • Acquire Request state()
  • Update Request cache()
  • Release Request State()
  • End Request()
  • Application_start()
  • Session _start()
  • Application _Error()
  • Session _End
  • Application_Disposed()
States in ASP.NET Application:-
State is quite an innovative concepts in web application Development because it eliminates the drawback of losing state data due to reloading of a web page .we can preserve the states of the application either at the server or client end.The sate of a web application help you to store the running time changes that have been made to web page.
There are various methods that store the state information on a client end which are given below:-
  • Hidden Fields :-> The content of the control is sent in the HTTP Form collection control along with values of other controls.This control acts as a storage area for any page_specific storing information.I will discuss this fields in details in Next tutorials with  example.
  • Cookies:->Cookies is a text file that store data,such as user ID and preferences at the client end.I will discuss this field in details in Next tutorials with  example.
  •  Query Strings:- It is used to refers the information strings added at the the end of a URL to maintains the state of a web application.Query strings is not  secure because their values are exposed to the Internet through the URL.I will discuss this field in details in Next tutorials.
There are various methods that store the state information on a Web server which are given below:-
  • Application State:- It stores application data not frequently modified by the users An object of the HttpApplicationState class is used to store the state of ASP.NET web application.I will discuss this state in next tutorial with examples.
  • Session state:- It stores the specific information to an user session.An object of the HttpSessionState class is used  to Store the session state for each ASP.NET  web Application that is executed.
  • Profile properties :- It stores a user specific data in a persistent form.
  • View state:- View state stores page -specific information .when a page is posted back to the server.
HTTP Handlers:- 
Httphandlers is used to handle the user requests for web application resources.we can defined Httphandlers in the <HttpHandlers> element of a configuration file.There are some methods of IHttpHandler interface.
  • Process Request():- It involved when a user request is received  It processes the request using the HttpContext object,which is passed as a parameter.
  • IsReusable:- It is used to determine whether the HTTP Handler object,accessed using the the Processrequest() method ,can be reused.
Post Back and Cross-page Posting:-
Post back is the process of sending the data back to the server for processing.This is done to authenticate the login and password of a client or other such tasks that a client can not perform on its own.Asp.Net provides a framework for handling post backs from ASP.NET Web pages.Post back contains Cross-page posting,which is the name given to the process of receiving the response of a request by the server on other page.
I will discuss each fields in details in Next, which i have mentioned in above.
For More:-
  1. Create setup file with database
  2. File Handling Real Application
  3. delegates in c#
  4. create captcha image 
  5. validation controls
  6. web forms controls
  7. print gridview data
To Get the Latest  Free Updates Subscribe

0 comments:

Post a comment

Powered by Blogger.