|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Be the architects of evolution and help create the mobile internet future. It’s your move---enter to win here! |
|
#1
|
|||
|
|||
|
how to use global.asa
( @
----' D hi there.. ( @ can anyone help me with my created global.asa file.. i'm a little bit confused with using application_onstart.. as u can see in the following code... my DB connection and SQL statements is currently included in my application_onstart event.. but, unfortunately, i wasn't able to reference Application("sUser") in my asp when i tried to run my website.. here's my code Sub application_onStart Application("sUser") = CStr(Request.ServerVariables("AUTH_USER")) Application("sPass") = CStr(Request.ServerVariables("AUTH_PASSWORD")) If Not Trim(Application("sUser") = "" Then 'Enterprise Directory Connection strEDUser = Application("sUser") strEDPassword = Application("sPass") strEDPath = "LDAP://dir.svc.accenture.com/DC=dir,DC=svc,DC=accenture,DC=com" 'If user has middle initial, foreign Initials will be selected from the database. 'Otherwise, only the Last Name and First Name will be selected. strEDQuery = "SELECT a-foreignSn, a-foreignGivenName, a-foreignInitials FROM '" & strEDPath & _ "' WHERE objectCategory='person' AND objectClass='user' AND userAccountControl = 672" & _ " AND (a-personnelNumber = '" & Application("sUser)" & "' OR cn = '" & Application("sUser") & "')" 'Connecting to the Enterprise Directory Set objEDConnection = CreateObject("ADODB.Connection") objEDConnection.Provider = "ADsDSOObject" objEDConnection.Properties("User Id") = strEDUser objEDConnection.Properties("Password") = strEDPassword objEDConnection.Properties("Encrypt Password") = True objEDConnection.Open "ADs Provider" Set objEDCommand = CreateObject("ADODB.Command") objEDCommand.ActiveConnection = objEDConnection objEDCommand.CommandText = strEDQuery Set objEDRS = objEDCommand.Execute 'Retrieve User Full Name If Not objEDRS.EOF Then sCreatorNm = replace((CStr(objEDRS.Fields("a-foreignGivenName")) & " " & (objEDRS.Fields("a-foreignInitials")) & " " & CStr(objEDRS.Fields("a-foreignSn")))," "," ") End If objEDConnection.Close Set objEDConnection = Nothing End If 'Retrieve User End Sub Sub session_onStart Session.Timeout = 720 If Session("User") = "" Then call cacheSetting If Request.Cookies("LOGIN") <> "1" Then sUser = Application("sUser") sPass = Application("sPass") Session("USER") = sUser Response.Cookies("LOGIN") = "1" Response.Redirect "po_body.asp" Else If Session("USER") = "" Then Response.Redirect "default.asp" Response.End Else Response.Redirect "po_body.asp" End If End If End If End Sub Sub cacheSetting Response.Buffer = True Response.Expires = -1000 Response.Expiresabsolute = Now() - 1 Response.AddHeader "pragma","no-cache" Response.AddHeader "cache-control","private" Response.CacheControl = "no-cache" Response.CharSet = "ISO-8859-1" End Sub Sub application_onEnd ''''''nothing happens''''''''''''' End Sub Sub session_onEnd ''''''nothing happens''''''''''''' End Sub |
|
#2
|
||||
|
||||
|
Verify that your global.asa file is being executed. It must be in the root of your web application. Place just one line of code in the onStart event which sets a Session or Application variable, then try to read it in a test ASP page. If it's not working, then most likely your IIS server is not executing global.asa. It's a common problem, especially on your development computer. Search google groups and/or support.microsoft.com for "global.asa not executing" for some great help on this.
-Dave |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > ASP Programming > how to use global.asa |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|