Wrox Home  
Search P2P Archive for: Go

  Return to Index  

aspx_beginners thread: Global Functions


Message #1 by "chris" <chris@n...> on Wed, 4 Sep 2002 17:54:27
Global Functions 
On Wednesday, September 04, 2002, Chris Tsoukala writes:  
Hi,
I am having problems with global.asax, I am trying to define a global 
variable that checks security on all my asp.net pages.

When I call the function from one of my asp.net pages I always 
get 'Global not defined' In this case Global is my Global class that I 
have setup which has the function CheckLogin method.

Why is this happening, what am I not doing ! or is there a bug with 
Global.asax as with Global.asa in the previous version of ASP !

My Code ;

Global.asax.vb file

<CODE>

Imports System 
Imports System.Web 
Imports System.Web.SessionState
Imports System.Diagnostics
Imports System.Configuration

Public Class Global
Inherits System.Web.HttpApplication

Public Sub CheckLogin()

If Session("Valid") <> "OK" Then
Server.Transfer("Login.aspx")
End if

End sub
End Class

aspx file

Dim p as New Global
p.CheckLogin()

<CODE>

If anyone can help me thanks in advance ! 
 

  Return to Index