cookie's problem

Discussion in 'ASP .Net Security' started by Carnacky, May 20, 2004.

  1. Carnacky

    Carnacky Guest

    hello all,
    i have a strange behaviour with this code

    in the index.aspx page i have this code:

    if not request.Cookies("Utente") is nothing then
    response.Redirect("index2.aspx")
    end if

    [...]

    if login.identificativo = 0 then
    label1.text = "Username o Password Errati"
    else
    Dim dt As DateTime = DateTime.Now()
    Dim ts As New TimeSpan(0,0,10,0)
    response.Cookies("Utente").path = "/"
    response.Cookies("Utente")("ID") =Login.identificativo
    response.Cookies("Utente").expires = dt.add(ts)
    server.Transfer("Index2.aspx")
    end if

    in the index2.aspx page i have this code:

    dim id as integer = Request.Cookies("Utente")("ID")

    [...]

    response.Cookies("Utente")("Nome")=ds.tables("tblUsers").rows(0)("firstname")
    response.Cookies("Utente")("Sex")=ds.tables("tblUsers").rows(0)("sex")
    response.Cookies("Utente")("Città")=ds.tables("tblUsers").rows(0)("city")
    response.Cookies("Utente")("Email")=ds.tables("tblUsers").rows(0)("email")

    from this page i can go to a page that contains messages for an user
    who have an his own archive in this way:
    messaggi.aspx page:


    [...]
    param = comm.selectcommand.parameters.add("@idric",
    OleDbType.integer)
    param.direction = parameterdirection.input
    param.value = request.Cookies("utente")("id")

    [...]

    cookie works good but there is a strange behaviour: if an user don't
    do the log out, when he comes again in index.aspx, he automatically go
    in index2.aspx as expected....but here the cookie, after retrieved all
    the information, disappear.
    i opened the path that contains the cookie and i see this strange
    behaviour. i want cookie remains in the client computer as i wrote in
    the code, but why it disappear??
    i don't understand,
    thanks to all and please try to help me

    la gestione del cookie funziona perfettamente...ma c'è un piccolo
    intoppo: se l'utente non fa il log out, quando ritorna, arriva
    direttamente nella pagina index2....e qui il cookie, misteriosamente,
    dopo aver rilevato tutte le informazioni, sparisce e così, quando
    accedo alla pagina dei messaggi mi dà errore in quanto il cookie non
    esiste più.
     
    Carnacky, May 20, 2004
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Ben
    Replies:
    3
    Views:
    5,856
    Steven Cheng[MSFT]
    Jun 3, 2004
  2. Shapper

    Cookie and Session Cookie Questions.

    Shapper, Apr 27, 2005, in forum: ASP .Net
    Replies:
    1
    Views:
    574
  3. =?Utf-8?B?UGF1bA==?=

    Cookie Question (IP as domain and cookie file location)

    =?Utf-8?B?UGF1bA==?=, Jan 10, 2006, in forum: ASP .Net
    Replies:
    1
    Views:
    2,485
    Bruce Barker
    Jan 10, 2006
  4. ad
    Replies:
    2
    Views:
    7,525
    Kevin Spencer
    Jan 27, 2006
  5. =?Utf-8?B?TnVubw==?=

    Convert a PHP cookie to an ASP.NET cookie

    =?Utf-8?B?TnVubw==?=, Jan 31, 2006, in forum: ASP .Net
    Replies:
    1
    Views:
    442
    =?Utf-8?B?UGV0ZXIgQnJvbWJlcmcgW0MjIE1WUF0=?=
    Jan 31, 2006
Loading...

Share This Page