473,395 Members | 1,938 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

difference between cookies and session variables

please tell me the differences between cookies and session variables. i am very confused with that.
Mar 17 '08 #1
2 5373
DrBunchman
979 Expert 512MB
Hi RamyaSrinath,

Basically the difference is that any data stored in a session variable is destroyed when the session ends (i.e. when the user logs off or closes the browser) but any data stored in a cookie will survive.

This is because cookies are stored on your local machine so the browser can access them each time you log in to a site with out having to prompt for the information again. This makes life easier for your user in most cases but the downside is that cookies can be blocked by some security settings.

A session variable is not stored on your local machine so as soon as your session is ended the variable is destroyed.

I hope this makes sense,

Dr B
Mar 17 '08 #2
Hi RamyaSrinath,

Basically the difference is that any data stored in a session variable is destroyed when the session ends (i.e. when the user logs off or closes the browser) but any data stored in a cookie will survive.

This is because cookies are stored on your local machine so the browser can access them each time you log in to a site with out having to prompt for the information again. This makes life easier for your user in most cases but the downside is that cookies can be blocked by some security settings.

A session variable is not stored on your local machine so as soon as your session is ended the variable is destroyed.

I hope this makes sense,

Dr B
hi. thank u for ur help
Mar 18 '08 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: kublai khan | last post by:
I am coming from (an elementary-level) javascript background. I set cookiesin select pages to see where the users are coming from and where they are going. It works quite nicely except that I'd...
20
by: Brian Burgess | last post by:
Hi all, Anyone know if this is possible? If so, on which page would the cookie be? .. On the page calling a function defined in the include file? thanks in advance.. -BB
9
by: | last post by:
Is it possible for a user to enable permanent cookies but disable session cookies.....this seems like a contradition yet this is what I appear to be reading in online articles?
2
by: What-a-Tool | last post by:
I am using a couple of session variables in my site. From what I can figure out, session information is stored on the users computer in a cookie - If the user has cookies disabled, do session...
4
by: VB Programmer | last post by:
If I have a variable I want to share in my application what is the difference between just declaring a variable (Dim strMyVar as String) and using a session variable (Session("strMyVar"))? When...
3
by: Galina Grechka | last post by:
Hi, I have a really bad problem with ASP.net application. It seemed fine until it was tested in multisession environment. When 2 users access the same aspx page at the same time sometimes the...
6
by: Paul | last post by:
Here is a question that should get everyone going. I have an ecommerce site where I need to pass the order_id to every page. So which method is the best practice to pass this variable between...
5
by: jheines | last post by:
I am trying to explain how cookies and sessions work in a class I teach, but I have hit a wall when it comes to the interaction between cookies and the state of the privacy settings in Internet...
3
by: damezumari | last post by:
To find out were session variables are stored I included this instruction in my program: echo ini_get("session.save_path"); The reply was /home/7604/data/tmp which is a folder on my server. I...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.