what is session and cookies

Posted by Rajesh11may under Regular Expressions on 3/6/2010 | Views : 82231 | Status : [Member] | Replies : 4
hi sir today i become your member
my question is that what is session management in asp.net and what are cookies i will be thankful to you please explain with example.

happy


Responses

Posted by: Puneet20884 on: 3/6/2010 [Member] Bronze

Up
0
Down
These are a bit vast concepts and can't be explained on the forum still the simple overview but the links added for details :

Session : Server Side objects for saving your data for the session you are using the site, there is a time for which these objects stay in the memory and that is defined in web.config for session state section otherwise 20 mins by default.
http://support.microsoft.com/kb/307598

Cookies: Client Side objects for saving your data for the site you are using, we need to set the time expiaration for these objects by default unlimited life time they possess
http://msdn.microsoft.com/en-us/library/ms178194.aspx

Best Regards,
Puneet Sharma - Infosys
Pune, India

Rajesh11may, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Abhijit Jana on: 3/6/2010 [Member] [MVP] Bronze

Up
0
Down
Rajesh,

Welcome To DotNetFunda !

Regarding your question, As Punnet said that, these are the very Vast concept I am also agree on that.

As HTTP Is stateless, we need to maintain the state of web information either on client or server side. Session is and Server side State Management and Cookies is the Client Site Side State Management.

I am giving you few reference for Session and Cookies Article, Hope that will be very helpful to you.

http://www.codeproject.com/KB/aspnet/ExploringSession.aspx
and
http://www.codeproject.com/KB/aspnet/Beginners_Cookies.aspx

Please read those article, if you need any more help please let me know.

Thanks !
Abhijit


Cheers !
Abhijit

Rajesh11may, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Abhi174 on: 3/8/2010 [Member] Starter

Up
0
Down
Session is stored in the Memory i.e RAM and once you have create a session you can acess the session through out the application if the session isn't killed where as cookies stored at client machine.Client can delete that file easily.

Rajesh11may, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Sagarp on: 3/10/2010 [Member] Bronze

Up
0
Down
cookies are only simple text that is stored on the client with some useful data to identify subsequent requests from the client and help the server to serve the client efficiently. cookies can hold data like books bought during an http session until the session expires. if you could store the nature of these books (e.g. fiction, technology etc.) then this data could be used to know the browsing behaviour of the user.
EX.c# CODE
HttpCookie cookie = Request.Cookies["Preferences"];


Sessions are objects (not text files) that store data and regarding a particular session and help the servlets to transfer this data to other servlet invocation so that the WEB SERVER understands (or is made to understand) that these requests have come from the same client. e.g. HttpSession objects are used to store such information.

ex. Session["UserName"] = txtUser.Text;


Thanks
SagarP
http://www.emanonsolutions.net
http://emanonsolutions.blogspot.com/

Rajesh11may, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response