I've been going bonkers trying to find the answer to this question...
I'm hoping somebody out there can help me. Our network environment is
Active Directory and our web server is Windows 2003 IIS 6.
I've got an ASP page that we include into each of our pages to act as
our companywide header. We force users to authenticate into our
Intranet site, and we are able to display the following information
about them on each page:
Welcome (username)
Today is (whatever)
Can Javascript or Dhtml or something else get me this information? We
have thousands and thousands of webpages and I don't want to have to
use the .asp extension on every single one if I don't have to... but I
can't find a way to display the username in the header without it =|
Somebody mentioned using File System Objects, but I haven't yet
experimented in that arena.
This is what my function looks like now...
shortdate = FormatDateTime(Now,vbShortDate)
longdate = FormatDateTime(Now,vbLongDate)
Const domainname = "amsec"
Function CurrentTime()
CurrentTime = FormatDateTime(Now,vbLongTime)
End Function
Function UserName()
Dim uid, uname
If OnSiteUser() = True Then
uid = Lcase(Request.ServerVariables("REMOTE_USER"))
UserName = Mid(uid,7)
Else
UserName = ""
End If
End Function
'------------------------------------------------------
' Returns TRUE if current user is member of named domain group
'------------------------------------------------------
Function MemberOf(groupname)
Dim usr, objUser, retval
On Error Resume Next
If Session(groupname) <> "" Then
If Session(groupname) = "YES" Then
retval = True
Else
retval = False
End If
Else
Set objUser = GetObject("WinNT://" & domainname & "/" & UserName() &
",user")
If err.Number <> 0 Then
Session(groupname) = "NO"
retval = False
Else
For each grp in objUser.Groups
If Ucase(groupname) = Ucase(grp.Name) Then
retval = True
End If
Next
Set objUser = Nothing
If retval = True Then
Session(groupname) = "YES"
Else
Session(groupname) = "NO"
End If
End If
End If
MemberOf = retval
End Function