473,386 Members | 1,748 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,386 software developers and data experts.

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.Cookies("CookieName").Value =
tmpObject.Text.Trim
Response.Cookies("CookieName").Expires =
DateTime.Now.AddDays(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 2250
On Aug 2, 5:31 am, Bill Nicholson <namewitheldbyrequ...@gmail.com>
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.comIt works as long as they browse towww.foobar.com. If they browse to foobar.com it doesn't see the
cookie. It they browse towww.foobar.com/Stuff.aspx, it doesn't see
the cookie.

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

Response.Cookies("CookieName").Value =
tmpObject.Text.Trim
Response.Cookies("CookieName").Expires =
DateTime.Now.AddDays(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*********@bluewin.chwrote in message
news:%2****************@TK2MSFTNGP02.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...@bluewin.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
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...
2
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...
7
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...
2
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...
3
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...
3
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...
5
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...
6
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...
5
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....
29
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...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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: 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
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,...
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...

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.