SunQuest
           ASP Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreASP Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Be the architects of evolution and help create the mobile internet future. It’s your move---enter to win here!
  #1  
Old August 12th, 2003, 08:36 PM
shantsai shantsai is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2003
Posts: 1 shantsai User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
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

Reply With Quote
  #2  
Old August 13th, 2003, 08:45 AM
WineIsGood's Avatar
WineIsGood WineIsGood is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2003
Location: New York
Posts: 49 WineIsGood User rank is Private First Class (20 - 50 Reputation Level)WineIsGood User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 7 m 51 sec
Reputation Power: 6
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

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreASP Programming > how to use global.asa


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway