Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
User = Request.ServerVariables("LOGON_USER")
If Request("LOGON_USER") = "" Then
Response.Status = "401 Unauthorized"
End if
'*****************************************************************************
'* This function passes the Logon_User ServerVariable to the parse function
'* which extracts the NT loginID of the current user. That value is then
'* returned in the psLoginID variable.
'*****************************************************************************
Function GetUserLogon
On Error Resume Next
GetUserLogon = ParseUserFromDomain(Request.ServerVariables("LOGON_USER"))
End Function
'****************************************************************************
'* This function obtains the user's logon account name from the full
'* domain name (with the logon name). The logon name should be the string
'* that appears after the last "\" found.
'****************************************************************************
Function ParseUserFromDomain(ByVal psLogonUser)
Dim nPosFound
Dim nPosOfLastSlash
Dim nInt
nPosOfLastSlash = 0
For nInt = 1 to Len(psLogonUser)
nPosFound = InStr(nInt,psLogonUser, "\")
If nPosFound > 0 Then
nPosOfLastSlash = nPosFound
End If
Next
If nPosOfLastSlash = 0 Then
'Look for forward slash
For nInt = 1 to Len(psLogonUser)
nPosFound = InStr(nInt,psLogonUser, "/")
If nPosFound > 0 Then
nPosOfLastSlash = nPosFound
End If
Next
If nPosOfLastSlash = 0 Then
ParseUserFromDomain = "Unknown"
Exit Function
End If
End If
ParseUserFromDomain = Trim(Mid(psLogonUser, (nPosOfLastSlash + 1), Len(psLogonUser)))
End Function
Function StripDomain(strLogonUser)
strLogonUser = Replace(strLogonUser,"/","\")
StripDomain = Right(strLogonUser, (Len(strLogonUser) - InStrRev(strLogonUser, "\", -1, vbTextCompare)))
End Function