Link to home
Start Free TrialLog in
Avatar of windcloud03
windcloud03

asked on

Session.SessionID

Hi,

I really need help on this one.

I have an asp application running off Windows 2000 with IIS5.0. Currently I have a global.asa file that intialise a connection string to my SQL server.

I have a login page to go into my application. When I login in, I will add and store the Userid, IP address and Session.SessionID in my Session table. Upon loading of a new asp page, I will always check if my Session.SessionID still exists and is the same as my Sessionid in database.

However, when I refer to the Session.SessionID again, the value changes and when I click on other asp pages, this value keeps incrementing. What should I do???

I have to track if the Session has timed out or a different session has occurred.

Can anyone help out or offer another solution?

Thanks
Avatar of Wakie
Wakie
Flag of Australia image

A few things you could try:

Request.ServerVariables("ALL_RAW")
Request.ServerVariables("HTTP_COOKIE")
Avatar of windcloud03
windcloud03

ASKER

Hi Wakie,

Problem is that my Session.SessionID keeps increasing whenever I click another asp page in my web application. I don't know why. I have a host name http://myhostname (with an IP address) which redirects to my login page.

However, if I use http://localhost, the SessionID is maintained even if I clicked on other asp pages. I am really unsure why this is happening.

I actually migrated my application to a Win2K Pro with IIS installed from a Win2K Server. Exactly the same code, the Win2K Server works fine.

Please advise.
Hello windcloud03,

I haven't had any experience with Session.SessionID but in the past if I want to check if a session is still active is to run a test on one of the session variables. For example:

<%
Username = Session("Username")
If Username = "" Then
   Response.Write "Session has expired."
   Response.End
End If
%>

Regards,
Wakie.
Hi windcloud03,

W2K Pro can have ONLY one web site.  You can have multiple virtual directories, each set as a separate ASP application.

I don't know why you would migrate FROM W2K server TO W2K Pro.   This is losing capability.  Plus, W2K Pro will limit you to a max of 10 simultaneous connections.

IAC, it sounds like each dir on the W2K pro machine is set up as an ASP application.  This will cause a new Session to be started the first time any file is accessed in each dir.

If you're using a virtual dir for your app on W2K pro, then make sure that none of the subdirectories are set as ASP applications.

Best Regards,
>apollois<
What's your real hostname?

Is there an underscore in the name?

p.e.

http://my_hostname

If this is the case, the session is lost.

Hi wboevink,

You are right. If you can let me know why that's the case, I will accept your comment and pass you the points.

Regards
That being said, you'd only use it if you were developing your application *on* the web server itself :)
I'm sorry I do not know why that's the case. I stumbled across this problem myself, it took me several hours before I figured it out.

The only thing I know is that an underscore is not a valid character in the hostname, it's somewhere in a rfc.

Happy to know that it solved your problem.
ASKER CERTIFIED SOLUTION
Avatar of Wakie
Wakie
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Good, think you got it, I cannot assign my computer name with an underscore ("_"), the session variables are lost.
Good catch Wakie.