Wrox Home  
Search P2P Archive for: Go

  Return to Index  

iis_applications thread: Session variable problem in IIS v4 and 5 but not IIs v5.1


Message #1 by andygrant@a... on Wed, 9 Oct 2002 10:53:58
Can you add checking value for Session("ClientIPAddress") to your 
test.asp page to see what's it?

Minny

-----Original Message-----
From: andygrant@a... [mailto:andygrant@a...]
Sent: Thursday, October 10, 2002 5:20 AM
To: IIS_Applictaions
Subject: [iis_applications] RE: Session variable problem in IIS v4 and 5
but not IIS v5.1


Minny

I have other pages which do not test the session variable and they all
work OK when called through the printpage.asp (which strips out the menu 

and navigation bars).

I have created a test.asp file which shows that the session variable 
AUTH
gets set back to "N" when run through the printpage.asp when run on NT
and 2000 but not on XP.

Test.asp code

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<HEAD>
<META HTTP-EQUIV=3D"Content-Type" CONTENT=3D"text/html; 
charset=3DISO-8859-1">
<META NAME=3D"Generator" CONTENT=3D"Microsoft FrontPage 
5.0"><TITLE>Intranet
ECbyName</TITLE>
<% PageTitle =3D "EC by Name"%>
<!-- START PPOMIT -->
<!-- END PPOMIT -->

Request.serverVariables("PATH_INFO") & "?" &
Request.serverVariables("QUERY_STRING")%>">Printer Friendly view

Some text at the start of the page

<% session.LCID =3D 2057
response.write("Session ID =3D " & Session.SessionID & "
")
response.write ("AUTH =3D " & session("auth") & "
")
if session("Auth") =3D "Y" then
    response.write("you are authorised")
else
    response.write("you are not authorised")
end if
%>



The sessionID also seems to change on ALL platforms but the session
variable AUTH stays at "Y" on XP.

I thought it might be something to do with the Global.asa  so here is 
the
code from that

<SCRIPT LANGUAGE=3DVBScript RUNAT=3DServer>
session.LCID =3D 2057
'*********************************************************
'THIS GOES IN GLOBAL.ASA

Sub Session_OnStart
    Session("Start") =3D Now
    Application.lock
    Application("visits") =3D Application("visits") + 1
    intTotal_visitors =3D Application("visits")
    Session("VisitorID") =3D intTotal_visitors
    Session("Auth") =3D "N"
    Session("ClientIPAddress") =3D 
Request.serverVariables("REMOTE_ADDR")
    If Session("ClientIPAddress") =3D "192.168.7.3" then
        Session("Auth") =3D "Y"
    end if
    If Session("ClientIPAddress") =3D "212.35.236.2" then
        Session("Auth") =3D "Y"
    end if
    Application.unlock
   
    Application.lock
    Application("Active") =3D Application("Active") + 1
    if Application("Active") > Application("MaxActive") then
        Application("MaxActive") =3D Application("Active")
        Application("MaxActiveTime") =3D WeekDayName(Weekday(now)) & ", 
" &
Day(Now) & " " & Monthname(month(now)) & " " & year(now) & " @ " & time
    end if
    Application.unlock
End Sub

Sub Session_OnEnd
    Application.lock
    Application("Active") =3D Application("Active") - 1
    Session("Auth") =3D "N"
    Application.unlock
End Sub

'*********************************************************

</SCRIPT>

Yes I am running the asp files from IP address 192.168.7.3 for testing
purposes.


Andy

  Return to Index