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?

Questions by cyus_sg

Editorial / Best Answer

Prabhat Chauhan  

  • Member Since Jul-2008 | Jul 23rd, 2008


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

Showing Answers 1 - 0 of 0 Answers

ranjaniav

  • Apr 19th, 2008
 

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.

bb.geetha

  • Jul 8th, 2008
 

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).

  Was this answer useful?  Yes

nanda kuma

  • Jul 17th, 2008
 

.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

  Was this answer useful?  Yes

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

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions