Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
Classic ASP Basics For beginner programmers starting with "classic" ASP 3, pre-".NET." NOT for ASP.NET 1.0, 1.1, or 2.0
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old June 29th, 2005, 04:30 AM
Authorized User
 
Join Date: Jun 2005
Location: , , .
Posts: 21
Thanks: 0
Thanked 0 Times in 0 Posts
Default AD Usernames

Hi there,

I've got a page displaying who the currently logged in user is, but it's displaying it in the 'DomainName\UserName' style.

Here's the code:

Code:
<HTML>
<HEAD>
<%
    Dim strUserName
    strUserName = Request.ServerVariables("LOGON_USER")
%>
</HEAD>

<BODY>
You are logged on as: [<%=strUserName%>]
</BODY>
</HTML>
Is it possible to remove the Domain Name and just display it as:

You are logged on as: [UserName]

Thanks/...

Oh, i've tried AUTH_USER as well, but it does the same thing!!

 
Old June 29th, 2005, 02:36 PM
Friend of Wrox
 
Join Date: Nov 2004
Location: Port Orchard, WA, USA.
Posts: 1,621
Thanks: 1
Thanked 3 Times in 3 Posts
Default

Code:
<html>
  <head>
     <%
         Dim strUsrNm
             strUsrNm = Request.ServerVariables("LOGON_USER")
             strUsrNm = Mid(strUsrNm, InStr(strUsrNm, "\") + 1)
     %>
  </head>

  <body>
     You are logged on as: [<%=strUsrNm%>]
  </body>
</html>




Similar Threads
Thread Thread Starter Forum Replies Last Post
Add existing AD user to AD group via ADSI? thiazi Classic ASP Basics 0 August 24th, 2007 09:27 PM
AD Credentials gygaxx Visual Basic 2005 Basics 4 January 10th, 2007 08:32 AM
usernames as keys JoeFuture BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 3 June 5th, 2006 07:02 AM
gathering usernames with asp.net regwood79 ASP.NET 2.0 Basics 1 January 26th, 2006 11:37 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.