home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Chip 1998 March
/
CHIPCD_3_98.iso
/
software
/
testsoft
/
exchange
/
webdata
/
usa
/
lib
/
logon.inc
< prev
next >
Wrap
Text File
|
1997-08-25
|
5KB
|
158 lines
<!--#include file="getrend.inc" -->
<%
'!--Microsoft Outlook Web Access-->
'!--Logon.inc - Logon functions-->
'!--Copyright (c) Microsoft Corporation 1993-1997. All rights reserved.-->
'=======================
' AuthenticateUser
' Ensures user is authenticated
'
'=======================
Public Function BAuthenticateUser
On Error Resume Next
BAuthenticateUser = False
bstrAT = Request.ServerVariables("AUTH_TYPE")
If InStr(1, bstrAuthTypesAccepted, bstrAT, vbTextCompare) < 2 Then
Response.Buffer = TRUE
Response.Status = ("401 Unauthorized")
Response.End
Else
BAuthenticateUser = True
End If
End Function
'=======================
' AccountDisabled
' Checks account property PR_EMS_AB_PROTOCOL_SETTINGS
'
'=======================
Private Function BAccountDisabled(objOMSession)
On Error Resume Next
'HTTP assumed to be enabled if property doesn't exist, or isn't found
BAccountDisabled = False
aProtocols = objOMSession.CurrentUser.Fields(&H81B6101F)
For Each strProtocol in aProtocols
If InStr(1, strProtocol, "HTTP", vbTextCompare) Then
If "0" = Mid( strProtocol, 6, 1) Then
BAccountDisabled = True
End If
Exit For
End If
Next
Err.Clear 'Ignore errors generated here
End Function
'=======================
' BLogonUser
' Logs user onto Server
'
' Returns: TRUE if Successful
'=======================
Public Function BLogonUser(bstrMailbox)
Dim objOMSession1
On Error Resume Next
BLogonUser = False
If (Session(bstrAuthenticated)) Then
bAuthenticated = True
Else
bAuthenticated = False
End If
Err.Clear
Set objOMSession1 = Server.CreateObject("MAPI.Session")
If (Err.Number <> 0) Then
ReportError1 L_errFailedToCreateSession_ErrorMessage
Else
set objRenderApp = Application( bstrRenderApp )
bstrExchServer = objRenderApp.ConfigParameter("Server")
if IsEmpty(bstrExchServer) then
bstrExchServer = Request.ServerVariables("SERVER_NAME")
end if
' Construct the OLEMSG profile from server and mailbox name
If (bAuthenticated) Then
bstrProfileInfo = bstrExchServer + vbLF + bstrMailbox
Else
bstrExchOrg = objRenderApp.ConfigParameter("Enterprise")
bstrExchSite = objRenderApp.ConfigParameter("Site")
bstrExchServDN = "/o=" + bstrExchOrg + "/ou=" + bstrExchSite +_
"/cn=Configuration/cn=Servers/cn=" + bstrExchServer
bstrProfileInfo = bstrExchServDN + vbLF + "anon" + vbLF + "anon"
End If
' Set user's locale before Logon -- do this with ObjectRenderer to avoid race condition
Set objRenderObj = GetObjectRenderer
Session.CodePage = objRenderObj.CodePage 'set the denali session codepage
objOMSession1.SetLocaleIDs objRenderObj.LCID, objRenderObj.CodePage
Set objRenderObj = Nothing ' Release
Err.Clear
objOMSession1.Logon "", "", False, True, 0, True, bstrProfileInfo
If (Err.Number <> 0) Then
ReportError1 L_errFailedConnect_ErrorMessage & bstrExchServer
Else
If (bAuthenticated) Then
If (BAccountDisabled(objOMSession1)) Then
objOMSession1.Logoff
ReportError1 L_errHTTPDisabled_ErrorMessage
Else
Err.Clear
Set objInbox = objOMSession1.Inbox
If (Err.Number <> 0) Then
objOMSession1.Logoff
Set objOMSession1 = Nothing
' This will exit the function
ReportError1 L_errFailedToGetInbox_ErrorMessage
End If
iTimeout = objRenderApp.ConfigParameter("AuthenticatedSessionTimeout")
If iTimeout = 0 Then
ITimeout = 60 'minutes
End If
Session.Timeout = iTimeout
End If
Else
iTimeout = objRenderApp.ConfigParameter("AnonymousSessionTimeout")
If iTimeout = 0 Then
ITimeout = 20 'minutes
End If
Session.Timeout = iTimeout
End If 'bAuthenticated
BLogonUser = True
Set Session(bstrOMSession) = objOMSession1
Session("hImp") = objRenderApp.ImpID
SetPageDefaults
End If 'Err <> 0
End If 'Err <> 0
End Function
%>