Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Session Dies if using Server name

Status
Not open for further replies.

bataraguru

Programmer
Jun 4, 2002
37
0
0
MY
hi, i'm currently doing a shopping cart system. i'm have experianced 2 wierd situation, especially for session variable.
i'm creating a session for a user that successfully logged into the system. for the time beign i'm doing the system at local server. i'm using IIS as my webserver and SQL as my dbms.
if i typed the address as server name, let say , the session will mysteriously died after i'm doing a page redirect to a member only page. but if i type the address as IP address like the session will hold the value until its expired.

could anyboy explain to me how this can happend? i would like to know what can i do to make the session stay alive if i call the address using the server name.

thanks in advanced..
 
From the browser side, a session is just a temporary cookie that holds a session ID.

The browser automatically sends this cookie along with any requests to the server. The browser may be sending cookies set by to the server referred to as .... No cookie, no session.
 
yea, iknow about that..
but is there any difference using IP or server name?
because from my experience if i'm using server name my session will die if i passed it to another page but if using IP address the session will be alive until it terminated.

thanks..
 
"... from my experience if i'm using server name my session will die if i passed it to another page ..."

Are you saying that it doesnt work if you go from one page using the server name as the URL to a second page using the server name?

Are you sure that the session actually expires and its not just the case that the session cookie is not sent?

Are you sure that none of your pages clear out your session variables or call Session.Abandon?
 
hmm.. for each of my protected page i will put code that will detected weather the user have been logged in or not. somehow i found that after setting session for loggedin = 1 and redirect to the secure page the session just die and it will bring to my default page where the redirection for loggedin = 0. its hard to explain though.. may be i'm just the only one that come into this problem.

cheers...
 
AFAIK, switching from a non-secure server to a secure server is equivalent to changing your domain. All of your cookies from the one will probably not be available from the other.

Tracy Dryden

Meddle not in the affairs of dragons,
For you are crunchy, and good with mustard. [dragon]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top