DotNetNewsgroup.com  
web access to complete list of Microsoft.NET newsgroups
   home   |   control panel login   |   archive  |  
 
  carried group
academic
adonet
aspnet
aspnet.announcements
aspnet.buildingcontrols
aspnet.caching
aspnet.datagridcontrol
aspnet.mobile
aspnet.security
aspnet.webcontrols
aspnet.webservices
assignment_manager
datatools
dotnet.distributed_apps
dotnet.general
dotnet.myservices
dotnet.nternationalization
dotnet.scripting
dotnet.security
dotnet.vjsharp
dotnet.vsa
dotnet.xml
dotnetfaqs
framework
framework.clr
framework.compactframework
framework.component_services
framework.controls
framework.databinding
framework.drawing
framework.enhancements
framework.interop
framework.odbcnet
framework.performance
framework.remoting
framework.sdk
framework.setup
framework.webservices
framework.windowsforms
framework.wmi
frwk.windowsforms.designtime
lang.csharp
lang.jscript
lang.vb
lang.vb.controls
lang.vb.data
lang.vb.upgrade
lang.vc
lang.vc.libraries
  
 
start date: Wed, 01 Aug 2007 20:31:06 -0700,    posted on: microsoft.public.dotnet.framework.aspnet        back       

Thread Index
  1    Bill Nicholson
          2    Alexey Smirnov
          3    Laurent Bugnion, MVP
          4    Eliyahu Goldin
                 5    Laurent Bugnion, MVP
                 6    Laurent Bugnion, MVP
                 7    Laurent Bugnion, MVP
          8    Bill Nicholson
          9    Bill Nicholson


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
Date:Wed, 01 Aug 2007 20:31:06 -0700   Author:  

Re: Cookie problem   
On Aug 2, 5:31 am, 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 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
Date:Thu, 02 Aug 2007 08:34:32 -0000   Author:  

Re: Cookie problem   
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/library/system.net.cookie.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
Date:Thu, 02 Aug 2007 10:53:30 +0200   Author:  

Re: Cookie problem   
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"  wrote in message 
news:%23DvGcKO1HHA.3916@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/library/system.net.cookie.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 
Date:Thu, 2 Aug 2007 12:03:43 +0300   Author:  

Re: Cookie problem   
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
Date:Thu, 02 Aug 2007 13:55:07 +0200   Author:  

Re: Cookie problem   
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" 
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
Date:Thu, 02 Aug 2007 08:01:29 -0700   Author:  

Re: Cookie problem   
Hi,

Bill Nicholson wrote:

> If the path is not specified, then it defaults to '/'. And I am not
> specifying it. So what's the problem?


No problems on my side. You described a symptom, I described the most 
common cause for it. We've got to start somewhere.

On the client side, when you watched document.cookie, what does the 
cookie string look like, and is the "path" part set?

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
Date:Thu, 02 Aug 2007 18:23:53 +0200   Author:  

Re: Cookie problem   
Sorry, Laurent. I meant "What's the problem with my cookie". I wasn't
flaming you. My bad!

On Aug 2, 12:23 pm, "Laurent Bugnion, MVP" 
wrote:

> Hi,
>
> Bill Nicholson wrote:
> > If the path is not specified, then it defaults to '/'. And I am not
> > specifying it. So what's the problem?
>
> No problems on my side. You described a symptom, I described the most
> common cause for it. We've got to start somewhere.
>
> On the client side, when you watched document.cookie, what does the
> cookie string look like, and is the "path" part set?
>
> 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
Date:Thu, 02 Aug 2007 11:00:46 -0700   Author:  

Re: Cookie problem   
Hi,

Bill Nicholson wrote:

> Sorry, Laurent. I meant "What's the problem with my cookie". I wasn't
> flaming you. My bad!


No worries Bill. I also wonder what's wrong with your cookie. YOu said 
you checked the cookie in IE and Netscape, you mean you watched the 
"document.cookie" JavaScript variable? Or what method did you use?

If you can, post the "document.cookie" string which is stored in the 
client. You can do that using JavaScript in your web page. It would be 
helpful to see what is really sent to the client, not just the 
high-level API calls in ASP.NET.

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
Date:Thu, 02 Aug 2007 20:12:11 +0200   Author:  

Google
 
Web dotnetnewsgroup.com


COPYRIGHT ?2005, EUROFRONT WORLDWIDE LTD., ALL RIGHT RESERVE  |   Contact us