-----------------------------------------------------------

New Message on MumbaiUserGroup

-----------------------------------------------------------
From: Swapnil_B1
Message 1 in Discussion

  
Server-side state management:  
Information will be stored on the server, it has higher security but it can use 
more web server resources.  
A. Aplication object  
The Application object provides a mechanism for storing data that is accessible 
to all code running within the Web application, The ideal data to insert into 
application state variables is data that is shared by multiple sessions and 
does not change often.. And just because it is visible to the entire 
application, you need to used Lock and UnLock pair to avoid having conflit 
value.  
Application.Lock();  
Application[“mydata”]=”mydata”;  
Application.UnLock();  
B. Session object  

Session object can be used for storing session-specific information that needs 
to be maintained between server round trips and between requests for pages. 
Session object is per-client basis, which means different clients generate 
different session object.The ideal data to store in session-state variables is 
short-lived, sensitive data that is specific to an individual session.

Each active ASP.NET session is identified and tracked using a 120-bit SessionID 
string containing URL-legal ASCII characters. SessionID values are generated 
using an algorithm that guarantees uniqueness so that sessions do not collide, 
and SessionID’s randomness makes it harder to guess the session ID of an 
existing session.
SessionIDs are communicated across client-server requests either by an HTTP 
cookie or a modified URL, depending on how you set the application's 
configuration settings. So how to set the session setting in application 
configuration? Ok, let’s go further to look at it.

Every web application must have a configuration file named web.config, it is a 
XML-Based file, there is a section name ‘sessionState’, the following is an 
example:

<sessionState mode="InProc" stateConnectionString="tcpip=127.0.0.1:42424" 
sqlConnectionString="data source=127.0.0.1;user id=sa;password=" 
cookieless="false" timeout="20" />

‘cookieless’ option can be ‘true’ or ‘false’. When it is ‘false’(default 
value), ASP.NET will use HTTP cookie to identify users. When it is ‘true’, 
ASP.NET will randomly generate a unique number and put it just right ahead of 
the requested file, this number is used to identify users, you can see it on 
the address bar of IE:

http://localhost/Management/(2yzakzez3eqxut45ukyzq3qp)/Default.aspx

Ok, it is further enough, let is go back to session object.

//to store information
Session[“myname”]=”Mike”;
//to retrieve information
myname=Session[“myname”]; 
C. Database
Database enables you to store large amount of information pertaining to state 
in your Web application. Sometimes users continually query the database by 
using the unique ID, you can save it in the database for use across multiple 
request for the pages in your site.  
Swapnil (swaps)  
http://swapsnet.spaces.live.com/

-----------------------------------------------------------

To stop getting this e-mail, or change how often it arrives, go to your E-mail 
Settings.
http://groups.msn.com/MumbaiUserGroup/_emailsettings.msnw

Need help? If you've forgotten your password, please go to Passport Member 
Services.
http://groups.msn.com/_passportredir.msnw?ppmprop=help

For other questions or feedback, go to our Contact Us page.
http://groups.msn.com/contact

If you do not want to receive future e-mail from this MSN group, or if you 
received this message by mistake, please click the "Remove" link below. On the 
pre-addressed e-mail message that opens, simply click "Send". Your e-mail 
address will be deleted from this group's mailing list.
mailto:[EMAIL PROTECTED]

Reply via email to