473,654 Members | 3,097 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Cookie problem

Maybe I don't understand cookies correctly. When some visits my site
and logs in, they get a cookie that stores their login information.
When they come back, that info is read from the cookie and they can
log in without having to remember their id/pw.

Assume the site is www.foobar.com It works as long as they browse to
www.foobar.com. If they browse to foobar.com it doesn't see the
cookie. It they browse to www.foobar.com/Stuff.aspx, it doesn't see
the cookie.

What am I missing? Do I need to store the cookie differently?

Response.Cookie s("CookieName") .Value =
tmpObject.Text. Trim
Response.Cookie s("CookieName") .Expires =
DateTime.Now.Ad dDays(1000)

The cookie looks fine - I checked it through the browsers (IE 6 and
FireFox).

Thanks,

Bill
Cincinnati, OH USA

Aug 2 '07 #1
5 2293
On Aug 2, 5:31 am, Bill Nicholson <namewitheldbyr equ...@gmail.co m>
wrote:
Maybe I don't understand cookies correctly. When some visits my site
and logs in, they get a cookie that stores their login information.
When they come back, that info is read from the cookie and they can
log in without having to remember their id/pw.

Assume the site iswww.foobar.co mIt works as long as they browse towww.foobar.co m. If they browse to foobar.com it doesn't see the
cookie. It they browse towww.foobar.co m/Stuff.aspx, it doesn't see
the cookie.

What am I missing? Do I need to store the cookie differently?

Response.Cookie s("CookieName") .Value =
tmpObject.Text. Trim
Response.Cookie s("CookieName") .Expires =
DateTime.Now.Ad dDays(1000)

The cookie looks fine - I checked it through the browsers (IE 6 and
FireFox).

Thanks,

Bill
Cincinnati, OH USA
Hi Bill,

add Trace="true" to the @Page directive at the start of the page, then
you should see details of your cookies

<%@ Page Trace="true" ... %>

Hope this helps to find the problem

Aug 2 '07 #2
Hi,

Bill Nicholson wrote:
Maybe I don't understand cookies correctly. When some visits my site
and logs in, they get a cookie that stores their login information.
When they come back, that info is read from the cookie and they can
log in without having to remember their id/pw.

Assume the site is www.foobar.com It works as long as they browse to
www.foobar.com. If they browse to foobar.com it doesn't see the
cookie. It they browse to www.foobar.com/Stuff.aspx, it doesn't see
the cookie.
Make sure you set the Cookie's path correctly. If you want the cookie to
be visible on your whole site, you must set the path to "/".
http://msdn2.microsoft.com/en-us/lib...okie.path.aspx

HTH,
Laurent
--
Laurent Bugnion [MVP ASP.NET]
Software engineering, Blog: http://www.galasoft.ch
PhotoAlbum: http://www.galasoft.ch/pictures
Support children in Calcutta: http://www.calcutta-espoir.ch
Aug 2 '07 #3
Well, there can be a problem if the path is set in anything different from
"/", There shouldn't be a problem if the path is not set at all. At the msdn
states:

If this property is not specified, then this Cookie will be sent to all
pages on the origin server or servers.

--
Eliyahu Goldin,
Software Developer
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
http://usableasp.net
"Laurent Bugnion, MVP" <ga*********@bl uewin.chwrote in message
news:%2******** ********@TK2MSF TNGP02.phx.gbl. ..
Hi,

Bill Nicholson wrote:
>Maybe I don't understand cookies correctly. When some visits my site
and logs in, they get a cookie that stores their login information.
When they come back, that info is read from the cookie and they can
log in without having to remember their id/pw.

Assume the site is www.foobar.com It works as long as they browse to
www.foobar.com. If they browse to foobar.com it doesn't see the
cookie. It they browse to www.foobar.com/Stuff.aspx, it doesn't see
the cookie.

Make sure you set the Cookie's path correctly. If you want the cookie to
be visible on your whole site, you must set the path to "/".
http://msdn2.microsoft.com/en-us/lib...okie.path.aspx

HTH,
Laurent
--
Laurent Bugnion [MVP ASP.NET]
Software engineering, Blog: http://www.galasoft.ch
PhotoAlbum: http://www.galasoft.ch/pictures
Support children in Calcutta: http://www.calcutta-espoir.ch

Aug 2 '07 #4
Hi,

Eliyahu Goldin wrote:
Well, there can be a problem if the path is set in anything different from
"/", There shouldn't be a problem if the path is not set at all. At the msdn
states:

If this property is not specified, then this Cookie will be sent to all
pages on the origin server or servers.
That would mean that the default value is "/". Anyway, the symptom being
that the cookie is not visible on all pages, this rather points to a
problem with the Path.

Greetings,
Laurent
--
Laurent Bugnion [MVP ASP.NET]
Software engineering, Blog: http://www.galasoft.ch
PhotoAlbum: http://www.galasoft.ch/pictures
Support children in Calcutta: http://www.calcutta-espoir.ch
Aug 2 '07 #5
If the path is not specified, then it defaults to '/'. And I am not
specifying it. So what's the problem?

On Aug 2, 7:55 am, "Laurent Bugnion, MVP" <galasoft...@bl uewin.ch>
wrote:
Hi,

Eliyahu Goldin wrote:
Well, there can be a problem if the path is set in anything different from
"/", There shouldn't be a problem if the path is not set at all. At the msdn
states:
If this property is not specified, then this Cookie will be sent to all
pages on the origin server or servers.

That would mean that the default value is "/". Anyway, the symptom being
that the cookie is not visible on all pages, this rather points to a
problem with the Path.

Greetings,
Laurent
--
Laurent Bugnion [MVP ASP.NET]
Software engineering, Blog:http://www.galasoft.ch
PhotoAlbum:http://www.galasoft.ch/pictures
Support children in Calcutta:http://www.calcutta-espoir.ch

Aug 2 '07 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

18
8836
by: Paul | last post by:
I link to a web site from an Excel spreadsheet. The page i link to is getCookie.asp which sets a cookie then returns back some html which opens a new window, to the same site but a different page (same folder). The cookie is not received. Can someone explain why? I worked around this by adding a cache-control header with a value of no-cache. This fixes the problem. Unfortunately that causes another problem with Internet Explorer...
2
2996
by: Syed Ghayas | last post by:
Hi, I've been having problem writing a cookie. Everything goes ok but when I supply the .Path property to "/" It just write the cookie when there is no cookie present, but when I try to update the cookie (or overwrite the cookie) it doesnt change it. My requirement to supply the path to "/" because ASP.NET reads it. If I write the cookie without supplying the path, the ASP.NET pages are unable to read the cookie.
7
2141
by: Christoph Pieper | last post by:
Hi, we've the following problem : We have an asp-application which sets the cookie on first login. The cookie will never be touched during user access. The user can work the whole day, but after 6 to 7 hours, the cookie get 2-4 new asp-sessionid's thus overwriting the very first entries in the cookie. Does anyone had the same problem or has a solution. The server is a w2003 enterprise the client has windows xp sp2.
2
1612
by: marshalli | last post by:
Hi: I have a problem with writing cookie from Jacascript. My problem is that I have two server, one is A, and the other is B. (1) I call a aaa.html from A. In aaa.html : ... <iframe id="frame1" src='http://B/bbb.html'></iframe> ... (2) In bbb.html :
3
2034
by: Ben | last post by:
I'm having problems with cookies from asp.net to asp back to asp.net. It seems like I can set a cookie in asp.net fine, and alter it at will, as soon as asp touches it, asp.net won't have anything to do with it. Can someone please help! The code below, going from aspx to aspx, works great the cookie as expected goes from qwerty to zxcvb and back. As soon as you hit the asp page, the cookie goes to asdfg and stays there no matter how...
3
11110
by: Wysiwyg | last post by:
After a server created cookie is processed on the client I want it removed, cleared, or expired in the javascript block but have been unable to do this. If I set a cookie value in the server code behind and don't use a domain then I can not change or remove that cookie's value on the client. If I subsequently create the cookie again in the codebehind then I actually end up with TWO cookies with the same name in the response. The cookie...
5
5293
by: Miljana | last post by:
Hi, I have one problem with cookies in ASP.NET application. It seems that I can not retreive cookie from Request.Cookies collection. I put cookie in Response.Cookies collection, and after page post back, when I try to retreive it from Request.Cookies collection, it appears that it does not exists. This problem does not occur on several developing machines we use for developing application, but occurs in another environment (another...
6
2695
by: kelvlam | last post by:
Hello all, I'm still a bit new with JavaScript, and I hope the guru here can shed some light for me. It's regarding handling cookie and the case-sensitive nature of JavaScript itself. My problem is how do I handle the "path" parameter in cookie. First, the sequence start at http://www.testServer1.com/TestApp/page1.htm, and a cookie is set at
5
2219
by: SJ | last post by:
Hi, In my website, i have a cookie that allows the user to remain logged in for upto 90days. So I'm setting the cookie expiration time to 90 days in the future from the time the user logs in. I've been testing my code and for some reason, the cookie expires randomly before even 24 hrs has passed. Yesterday it expired after 11hrs and 20mins. Any idea why my cookie expiration isn't working?
29
2998
by: Jerim79 | last post by:
I did try to find the answer to this before posting, so this isn't a knee jerk reaction. What I am trying to accomplish is to have a script that opens a cookie, reads a value, and then use a switch/case to take action based on that value in the cookie. I want to set the cookie manually, so I don't need setcookie(). I see that in PHP it stores the cookie in memory. Is there a way to have PHP just read a cookie from the desktop machine?...
0
8375
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8290
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
8482
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8593
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7306
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
4294
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2714
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1916
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1593
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.