c# - Response cookies available in browser -
i asked similar question yesterday, i've made further research , title yesterday's question isn't quite accurate.
i have asp.net/c# app. in server-side code, i'm setting couple cookies: mylogin , mysession. in c# code i'm adding add these code response.cookies. see them come in response in fiddler.
my server-side code being called via javascript so:
document.location.href = myurl; debugger; in fiddler see mylogin cookie has expiration set month today. mysession doesn't have expiration.
i'm using ie developer tools step through javascript code above. while i'm stopped @ debugger line above run following test page created in same directory .aspx page:
<html> <head> <script> var mycookies = "<h1>cookies</h1><br/>"; mycookies += document.cookie; //alert(mycookies); document.write(mycookies); </script> </head> <body> </body> </html> i see cookies sent document.location.href = myurl, not cookies sent in response. i'd expect cookies set on each http request/reponse keep getting sent browser every request, until expired.
i'm not seeing mysession , mylogin cookies getting passed web service call that's being called javascript in load myurl.
yesterday suggested cookies might httponly, http property on both mylogin , mysession cookies false in c# code. there way view property in fiddler?
-eric
i turned out problem had case-sensitivity in cookie urls. setting cookies against
http://myserver/mydir but trying read them in
http://myserver/mydir. see why cookie paths case sensitive?
-eric
Comments
Post a Comment