Create cookie in windows application

  • 14 years ago

    Hi,

    How can I create a cookie in a windows application not in asp. This is the code I already have (the "System.Web" library have to be added from the Project/Add References:

    Imports System.Web

    Imports System.IO

     

    Public Class Form1

     

        Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

            'Dim myCookie1 As New HttpCookie("Coordenadas")

            'myCookie1("CordX") = TextBox1.Text

            'myCookie1("CordY") = TextBox2.Text

     

            Dim myTextWriter As TextWriter

            Dim Response As New HttpResponse(myTextWriter)

            'Response.Write(myCookie1)

            'Response.Cookies.Add(myCookie1)

            Response.Cookies("Coordenadas")("CordX") = TextBox1.Text

            Response.Cookies("Coordenadas")("CordY") = TextBox2.Text

        End Sub

    End Class

     
  • 13 years ago
  • 13 years ago

    HI,

    THE THING IS THAT THE HTTPRESPONSE OBJECT I CANT GET IT WORK IN WINDOWS APP'S IN ASP .NET WORKS OK BUT IN WINDOWS IT DOESNT.

Post a reply

Enter your message below

Sign in or Join us (it's free).

Contribute

Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.” - Rich Cook