display username in company's Intranet header

W

Whitney

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
 
G

Grant Wagner

Whitney said:
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.

No, there is no way to retrieve the information you want using client-side
JavaScript in the default security environment in a cross-browser way
(although that probably isn't an issue here).

Your solution of retrieving the information you want on the server is the
right one. I'd suggest you either reconfigure IIS to serve up .html files
as ASP, or see if you can server-side #include a file that will execute
the code you want in your static .html files. I don't know if IIS can
server-side #include an ASP file in a static .html file or not, but it's
something to look into.
 
I

Ivan Marsh

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?

God no, thankfully.
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.

Why not pull the information once at login and stick it in a session
variable?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,767
Messages
2,569,572
Members
45,046
Latest member
Gavizuho

Latest Threads

Top