Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Creating cookie
Message
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Titre:
Divers
Thread ID:
00916866
Message ID:
00917457
Vues:
8
Cathi,
Page Tracing is an excellent suggestion. I think it will help me understand the Request and Response object and the timing of each firing. I am still struggling to understand those. By the way, today I was testing the app on customer web server and cookies were created fine. It is only when I do it on my notebook I can't get the consistent results. I am sure it is just my misunderstanding of things.
Thank you for you help.


>Hi Dmitry,
>
>I tried your sample code and it worked for me just fine. I would suggest turning on Page Tracing for the page and see if you see the cookie.
>
>>I was wondering if anybody can see what I am doing wrong in creating a
>>cookie:
>>
>>cUserId = Guid.NewGuid().ToString().GetHashCode().ToString("x");
>>
>>HttpCookie oCookie2 = new HttpCookie( "MyTestCookie", cUserId );
>>
>>oCookie2.Expires = DateTime.Now.AddMonths(24);
>>Response.Cookies.Add(oCookie2);
>>
>>
>>Then when I check the cookie collection, I never see this "MyTestCookie".
>>Here is how I check for all cookies:
>>
>>
>>foreach ( string strKey in Request.Cookies )
>>{
>>Response.Write("<li>" + strKey + " = " + Request.Cookies[ strKey ].Values );
>>}
>>
>>
>>The only cookie I see in the foreach above is ASP.NET_SessionId
>>
>>What am I missing?
>>
>>Thank you.
"The creative process is nothing but a series of crises." Isaac Bashevis Singer
"My experience is that as soon as people are old enough to know better, they don't know anything at all." Oscar Wilde
"If a nation values anything more than freedom, it will lose its freedom; and the irony of it is that if it is comfort or money that it values more, it will lose that too." W.Somerset Maugham
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform