Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to set a cookie?
Message
From
22/05/2008 16:47:12
 
 
To
22/05/2008 16:41:01
General information
Forum:
Visual Basic
Category:
Internet applications
Miscellaneous
Thread ID:
01319042
Message ID:
01319121
Views:
14
>I've had a hunch that the Response object was a server object. The question becomes where would I put the cookie container? The app is an MDI app, and I'm using the Parent Form to hold a few properties that need to stay available throughout the course of the execution - could I stash the cookie container there, as a property? For that matter, after I've created the cookie container (and the cookie), could I force another request to get the server to recognize the new cookie?
>
>Perhaps dumb questions, but these are new waters for me. TIA...

Yes, once the cookie container is establish, it means that all incoming cookies from the server will live. In the way I use it, where I sent a call to a Login() method at first, receives a confirmation that includes the cookie, it means that all upcoming requests will transmit back that cookie to the server knows who did the login.

I use it like that:
            ' Web service login
            loWebService.CookieContainer = New System.Net.CookieContainer
            llLogged = loWebService.Login(lcUsername, lcPassword)
            If Not llLogged Then
                MessageBox.Show("Unable to log in to the Web Service", lcWindowCaption, MessageBoxButtons.OK, MessageBoxIcon.Warning)
                Running.Text = ""
                Return
            End If
So, before sending the call to the login method, I create the cookie container assigned to the Web Service object. So, it means that if a cookie is sent back to me, after the Login() call, it will live in the Web Service object.

But, in that scenario, the cookie is created on the server side. In your case, you are trying to create it from the client side which will differ.
Michel Fournier
Level Extreme Inc.
Designer, architect, owner of the Level Extreme Platform
Subscribe to the site at https://www.levelextreme.com/Home/DataEntry?Activator=55&NoStore=303
Subscription benefits https://www.levelextreme.com/Home/ViewPage?Activator=7&ID=52
Previous
Reply
Map
View

Click here to load this message in the networking platform