GeekInterview.com
  I am new, Sign me up!
 
GeekInterview.com  >  Interview Questions  >  Microsoft  >  ASP.NET
Go To First  |  Previous Question  |  Next Question 
 ASP.NET  |  Question 153 of 164    Print  
how does the cookies work in asp.net?
i want to know the complete follow of the page how it store cookies and user info into session and when it get terminate also is it possible to call in-process application to out-process?


  
Total Answers and Comments: 4 Last Update: July 23, 2008     Asked by: cyus_sg 
  
 Sponsored Links

 
 Best Rated Answer
Submitted by: Prabhat Chauhan
 
we know Http is an state-less protocol which is required for interaction between clinet and server .

so there is an need to remeber state of request raised by an web browser so that
web server can recognize you have already previously visited or not.

There are two types of state management techniques:
a) Client side state management
b) Server - side statemanagement

Using cookies comes under clinet side statemanagement .In HttpResponse we write
Cookie containing sessionId and other information within it.

when a browser made a request to the web server the same cookie is sent to the server where server recognize the session id and get other information stored to it previously.

Cons:
1)Cookie should contain non sensitive data as one can easily read cookies and they result of which your security may be tampered .
2) Cookie should not contain large amount of information as they are sent back and forth with request and response in between client and server which may cause your
Performance degradation


Above answer was rated as good by the following members:
kavisasi, sharath R chandra, shebageorge, ravindra_satyam, Ag2703
April 19, 2008 07:19:24   #1  
ranjaniav Member Since: April 2008   Contribution: 2    

RE: how does the cookies work in asp.net?
When we create a cookie it will be stored in the user's hard disk. When the user visits our site the next time the browser sends all the cookies(or the particular cookies based on the Path/Domain properties we mentioned at the time of creation of the cookie) to the server. If the cookie has expired the browser won't send it to the server but it deletes.
 
Is this answer useful? Yes | No
July 08, 2008 07:19:31   #2  
bb.geetha Member Since: May 2008   Contribution: 8    

RE: how does the cookies work in asp.net?

A cookie is stored on the client's machine by their web browser software. There are good levels of compatibility in browser implementations so using them is generally hassle-free. When a web server receives an HTTP request it responds with an HTTP response. To set a cookie we include information in an HttpResponse that instructs the browser to save a cookie on the client's system. Future HttpRequests will then include details of this and other cookies.

Be very clear about cookies; when you call HttpCookie.Add the cookie is not added to anything except a collection in the HttpResponse that will be sent back to the web browser. The cookie is only stored on the client's machine when the browser has successfully processed the instruction to save the cookie that it received in an HttpResponse. We at the server can only check that cookie has been saved when we receive another HttpRequest as we can then see whether the request includes our cookie.

Note as well that cookies are strings and are invariably quite short (you cannot save objects in cookies).


 
Is this answer useful? Yes | No
July 17, 2008 09:39:51   #3  
nanda kuma Member Since: July 2008   Contribution: 1    

RE: how does the cookies work in asp.net?
.NET FRAMEWORK AS 2 COMPONENTS
1. CLR(common language runtime)
2. base class library
- it manages the execution of pgms on cpu
- provides an run time environment for all the .net applications
- also it provides memory management garbage collection security

 
Is this answer useful? Yes | NoAnswer is useful 0   Answer is not useful 2Overall Rating: -2    
July 23, 2008 07:13:53   #4  
Prabhat Chauhan Member Since: July 2008   Contribution: 1    

RE: how does the cookies work in asp.net?
we know Http is an state-less protocol which is required for interaction between clinet and server .

so there is an need to remeber state of request raised by an web browser so that
web server can recognize you have already previously visited or not.

There are two types of state management techniques:
a) Client side state management
b) Server - side statemanagement

Using cookies comes under clinet side statemanagement .In HttpResponse we write
Cookie containing sessionId and other information within it.

when a browser made a request to the web server the same cookie is sent to the server where server recognize the session id and get other information stored to it previously.

Cons:
1)Cookie should contain non sensitive data as one can easily read cookies and they result of which your security may be tampered .
2) Cookie should not contain large amount of information as they are sent back and forth with request and response in between client and server which may cause your
Performance degradation

 
Is this answer useful? Yes | NoAnswer is useful 5   Answer is not useful 0Overall Rating: +5    


 
Go To Top


 Sponsored Links

 
About Us -  Privacy Policy -  Terms and Conditions -  Contact -  Ask Question -  Propose Category -  Site Updates 

Copyright © 2005 - 2009 GeekInterview.com. All Rights Reserved

Page copy protected against web site content infringement by Copyscape