Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
ASP.NET 2.0 Professional If you are an experienced ASP.NET programmer, this is the forum for your 2.0 questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Professional 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 November 8th, 2006, 11:25 AM
Registered User
 
Join Date: Nov 2006
Location: Brentwood, TN, USA.
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Incorrect NTLoginName

I need to find the NTLoginID of the currently logged in user on a Web Site, preferably using C#. I have tried several different methods and all work fine locally, but do not on my server. Below, I have what I have tried, as well as the response I got from the server. For everything I tried locally, I either got the Domain\NTLoginID or just the NTLoginID.

System.Windows.Forms.SystemInformation.UserName.To String()
Server: NETWORK SERVICE

Page.User.Identity.Name.ToString()
Server:

Request.Params["AUTH_USER"].ToString()
Server:

Convert.ToString(Request.ServerVariables["REMOTE_USER"])
Server:

User.Identity.Name.ToString()
Server:

System.Security.Principal.WindowsIdentity.GetCurre nt().Name.ToString()
Server: NT AUTHORITY\NETWORK SERVICE

WindowsPrincipal wpUser = (WindowsPrincipal)System.Threading.Thread.CurrentP rincipal;
wpUser.Identity.Name.ToString():
Server:

How can I get at least one of these (or find another way) to give the correct domain/username or just the username?





Similar Threads
Thread Thread Starter Forum Replies Last Post
Incorrect syntax near '.' meraj ADO.NET 6 February 27th, 2012 01:01 AM
Incorrect syntax near '!' sinapra Classic ASP Databases 8 August 25th, 2004 02:15 AM
Incorrect syntax near '`' Hez Classic ASP Databases 3 August 5th, 2004 08:13 AM
Incorrect Characters webguy Classic ASP Databases 1 July 4th, 2004 09:52 AM
Incorrect syntax...... Adam H-W Classic ASP Databases 8 June 21st, 2004 11:14 AM





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