Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Can't Write Cookie IE

Reply
Thread Tools

Can't Write Cookie IE

 
 
=?Utf-8?B?R2FycmV0dEQ3OA==?=
Guest
Posts: n/a
 
      07-05-2005
I am having trouble with my authentication cookie with IE. I create and write
the cookie here but some of the client PC never get the cookie. This does
work with other browsers like Firefox.

If Request.Cookies("portalroles") Is Nothing Then

Dim _user As New UsersDB
Dim roleStr As String = ""
Dim role As String

roleStr = _user.GetRoles(User.Identity.Name)


'For Each role In roles

'roleStr += role
'roleStr += ";"

'Next

Dim ticket As New FormsAuthenticationTicket(1, _
Context.User.Identity.Name, _
DateTime.Now, _
DateTime.Now.AddHours(1), _
False, _
roleStr)

Dim cookieStr As String = FormsAuthentication.Encrypt(ticket)


'Send Cookie to client
Response.Cookies("portalroles").Value = cookieStr
Response.Cookies("portalroles").Path = "/"
Response.Cookies("portalroles").Expires =
DateTime.Now.AddMinutes(5)

Worst part is this works on most of my clients but not on other.s
Thanks
 
Reply With Quote
 
 
 
 
Curt_C [MVP]
Guest
Posts: n/a
 
      07-05-2005
Are you sure the clients have their browser set to allow cookies?
Some dont.


--
Curt Christianson
site: http://www.darkfalz.com
blog: http://blog.darkfalz.com


GarrettD78 wrote:
> I am having trouble with my authentication cookie with IE. I create and write
> the cookie here but some of the client PC never get the cookie. This does
> work with other browsers like Firefox.
>
> If Request.Cookies("portalroles") Is Nothing Then
>
> Dim _user As New UsersDB
> Dim roleStr As String = ""
> Dim role As String
>
> roleStr = _user.GetRoles(User.Identity.Name)
>
>
> 'For Each role In roles
>
> 'roleStr += role
> 'roleStr += ";"
>
> 'Next
>
> Dim ticket As New FormsAuthenticationTicket(1, _
> Context.User.Identity.Name, _
> DateTime.Now, _
> DateTime.Now.AddHours(1), _
> False, _
> roleStr)
>
> Dim cookieStr As String = FormsAuthentication.Encrypt(ticket)
>
>
> 'Send Cookie to client
> Response.Cookies("portalroles").Value = cookieStr
> Response.Cookies("portalroles").Path = "/"
> Response.Cookies("portalroles").Expires =
> DateTime.Now.AddMinutes(5)
>
> Worst part is this works on most of my clients but not on other.s
> Thanks

 
Reply With Quote
 
 
 
 
=?Utf-8?B?R2FycmV0dEQ3OA==?=
Guest
Posts: n/a
 
      07-05-2005
Sorry I forgot to mention that. Yes we have worked and worked with the
clients including setting their privacy settings to nothing and this stil
doesn't seem to have any effect.

"Curt_C [MVP]" wrote:

> Are you sure the clients have their browser set to allow cookies?
> Some dont.
>
>
> --
> Curt Christianson
> site: http://www.darkfalz.com
> blog: http://blog.darkfalz.com
>
>
> GarrettD78 wrote:
> > I am having trouble with my authentication cookie with IE. I create and write
> > the cookie here but some of the client PC never get the cookie. This does
> > work with other browsers like Firefox.
> >
> > If Request.Cookies("portalroles") Is Nothing Then
> >
> > Dim _user As New UsersDB
> > Dim roleStr As String = ""
> > Dim role As String
> >
> > roleStr = _user.GetRoles(User.Identity.Name)
> >
> >
> > 'For Each role In roles
> >
> > 'roleStr += role
> > 'roleStr += ";"
> >
> > 'Next
> >
> > Dim ticket As New FormsAuthenticationTicket(1, _
> > Context.User.Identity.Name, _
> > DateTime.Now, _
> > DateTime.Now.AddHours(1), _
> > False, _
> > roleStr)
> >
> > Dim cookieStr As String = FormsAuthentication.Encrypt(ticket)
> >
> >
> > 'Send Cookie to client
> > Response.Cookies("portalroles").Value = cookieStr
> > Response.Cookies("portalroles").Path = "/"
> > Response.Cookies("portalroles").Expires =
> > DateTime.Now.AddMinutes(5)
> >
> > Worst part is this works on most of my clients but not on other.s
> > Thanks

>

 
Reply With Quote
 
Curt_C [MVP]
Guest
Posts: n/a
 
      07-05-2005
GarrettD78 wrote:
> Sorry I forgot to mention that. Yes we have worked and worked with the
> clients including setting their privacy settings to nothing and this stil
> doesn't seem to have any effect.
>


Ok... guess the next thing is to find out what IS different.
If one client works and the next doesnt and they both have the same
browser start looking deeper. Most likely its not a server issue, its a
client one. Firewalls, proxy servers, etc... also, OS ver, Service
Packs, etc....

Sorry I cant be more specific in this instance but its a difficult one
to know. There are a number of options

--
Curt Christianson
site: http://www.darkfalz.com
blog: http://blog.darkfalz.com
 
Reply With Quote
 
=?Utf-8?B?R2FycmV0dEQ3OA==?=
Guest
Posts: n/a
 
      07-05-2005
Well thanks. I have been trying to figure out what is different but haven't
had any luck. Just seems strange because you can surf other sites and the
cookies write and can be read fine but my site it won't work.

"Curt_C [MVP]" wrote:

> GarrettD78 wrote:
> > Sorry I forgot to mention that. Yes we have worked and worked with the
> > clients including setting their privacy settings to nothing and this stil
> > doesn't seem to have any effect.
> >

>
> Ok... guess the next thing is to find out what IS different.
> If one client works and the next doesnt and they both have the same
> browser start looking deeper. Most likely its not a server issue, its a
> client one. Firewalls, proxy servers, etc... also, OS ver, Service
> Packs, etc....
>
> Sorry I cant be more specific in this instance but its a difficult one
> to know. There are a number of options
>
> --
> Curt Christianson
> site: http://www.darkfalz.com
> blog: http://blog.darkfalz.com
>

 
Reply With Quote
 
Curt_C [MVP]
Guest
Posts: n/a
 
      07-06-2005
GarrettD78 wrote:
> Well thanks. I have been trying to figure out what is different but haven't
> had any luck. Just seems strange because you can surf other sites and the
> cookies write and can be read fine but my site it won't work.
>

I've had similar in the past and most of the time it ended up being the
security settings in IE actually, specifically the URL getting read as
intranet inadvertantly (or vice versa).

As a test just do a simple 2 page app with one writing and one reading
and put it out on your server and start with that as a control group, to
eliminate something with your specific site setup... just to see.


--
Curt Christianson
site: http://www.darkfalz.com
blog: http://blog.darkfalz.com
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
What is different between Request.Cookie and Response.Cookie ad ASP .Net 2 01-27-2006 12:54 PM
Cookie Question (IP as domain and cookie file location) =?Utf-8?B?UGF1bA==?= ASP .Net 1 01-10-2006 08:37 PM
Any downsides to cookie assignment inside custom class using HttpContext.Current? ASP.NET 2.0 cookie fix? ASP .Net 2 08-17-2005 06:43 AM
Cookie and Session Cookie Questions. Shapper ASP .Net 1 04-27-2005 11:20 AM
Session cookie? Browser instance cookie? Ben ASP .Net 3 06-03-2004 03:41 AM



Advertisments