cookie's problem

C

Carnacky

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ù.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top