.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

Get system logged In Domain & username

Posted By:      Posted Date: September 16, 2010    Points: 0   Category :ASP.Net
Hi, I got a website with FBA authenication. I  want to get the client machine's domain & username. After lot of goggling I got the thing that if Enable annonymous is Check then it is not possible to get these things and would return "" whatever you try like HttpContext.Current.User.Identity.Name Request.LogonUserIdentity.Name Environment.UserDomainName.   Does anyone knows how to get the client's system domain & username.    

View Complete Post

More Related Resource Links

System.Data.SqlClient.SqlException: Login failed for user . Reason: The account is disable


Hi All,

Thank you for advance.

I created a widows service for mail schedule with c#.net and sql server 2005 and it is working fine for past one year.

now sometimes i am getting the "System.Data.SqlClient.SqlException: Login failed for user '<UserName>'. Reason: The account is disabled." error.

then i restarted the windows service manually and working.

what is the problem in my sql server connection and how to fix that issue?

Display Full Name in SharePoint instead of Domain\Username

My SharePoint 2010 server started displaying the users with the Domain\Username standard instead of using Full Name (as it did up to yesterday). This in all pages of the sites (persmission settings, document libraries, tasks, etc.) Does anybody knows how to force SharePoint to display users with the "full name" standard? Thank you.Plo

"The username is invalid. The account must be a valid domain account."

So I'm at the SharePoint Products Configuration Wizard, I put in the Database Server and name then put in the username and password. It just keeps saying this message after I hit the Next button! :   The username is invalid. The account must be a valid domain account.   What's wrong?

The specified user account "domain\username" is a local account. Local accounts should only be used

HI Im getting this error when trying to set a new Service account for my performance point services. SharePoint is installed in a single server enviroment. I can´t get a new service account configured and I think this is causing my server to run slowly. Any help would be highly appreciated thanks

change system account to username?

HI, I have created out-of-box workflow ,in the version history the modifiedby column  showing as system account instead of username. so want to display actual username instead of system account. help is appreciated. Thanks.

How to change the System Account into Domain Administrator account in Sharepoint?

I'm attaching the captured image from the Central Admin of our Sharepoint Server. (http://www.experts-exchange.com/images/346242/Central-Admin.jpg) As you can see from the Central Admin image, the user account shown is "System Account", in whereas I logged in as our Domain Administrator. Then when you check it's info from My Settings, the details from the captured image System Account Info was shown. ( http://www.experts-exchange.com/images/346243/System-Account-Info.jpg) How can I change it as be DOMAIN\Administrator & not SHAREPOINT\system or System Account? Please advise...  

Logon to SharePoint 2010 requires \. Why?

We've installed a fairly large number of small SharePoint 2007 environments. All of these have had their own Active Directory, specified to <domainname>.local. These have been accessible from Internet, and have simply had a external DNS pointingwww.<domain>.com to the server.  In these SharePoint 2007 environments we've used Windows Authentication, and logging on has simply been a procedure of specifying username and password. It has worked just fine. However, in our first SharePoint 2010 environment, we're encountering odd problems. We use here NTLM authentication, and  domain name is <domain>.local. The domain name used in Internet iswww.<domain>.com, which points to the SharePoint 2010 environments frontend server. We'd like to login to the SharePoint environment with simple <username> and password, but it fails. We have to explicitely specify <domain>\<username> and then password to login. Why doesn't this work, and is there any relatively easy way to fix this without disturbing the environment? From logon attempts using simply username, these events appear in the Security event log: Log Name: Security Source: Microsoft-Windows-Security-Auditing Date: 7.5.2010 13:15:01 Event ID: 4625 Task Category: Logon Level: Information Keywords: Audit Failure User: N/A Computer: <COMPUTER>.<

display of username in "domain/user" instead of "surname givenname"



we have a Sharepoint server 2010 running and at the top right of the website the username is showing like domain\username.

The same thing in documentlibraries and lists.

How can I change this to "surname givenname"?


I have configured a userprofilsync with our Domaincontroller and all of our users can be found in the Sharepoint Central Admin User Profils section with the correct Name.



Problem in displaying username after logged in


I having problem in display the username after a user logged in. Can anyone give some suggestions. Also, few lines of code will be appreciated.

This is my master page which has label which named Label1 on top right, i want to display the username on there after logged in. 


using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Xml.Linq;
using System.Data.SqlClient;

public partial class MasterPage : System.Web.UI.MasterPage
    protected void Page_Load(object sender, EventArgs e)
        Label1.Text = Session["Username"].ToString();
    protected void lbtnLogout_Click(object sender, EventArgs e)


It will display Object reference not set to an instance of an object when build the website.

Here is the Login Page

using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using Syste

Obtain domain username without requiring authentication


I'm bangin' my head against the wall here.  I'm not even sure what I want to do is possible.

I have developed an ASP.NET app that will only be run on my local network (which incorporates a Windows Domain).  It's running on IIS 7.5.

I want to do this:

Dim username as string = Httpcontext.Current.User.Identity.Name

My problem is this: If I don't turn off Anonymous Authentication and ASP.NET Impersonation, I don't get the results I'm looking for.  (if Anonymous is allowed, I get an empty string returned for username, and if ASP.NET impersonation is allowed, then "username" is always whatever account is associated with impersonation, like "Network Service").  If I turn those off and then turn Windows Authentication on, it works, but only after a dialog box presents itself asking for the Windows Credentials.

What I'm trying to do is NOT require the users to log in.  Since they've already logged into the domain when they signed on their computer, I'd like to just allow them access to the ASP.NET application I've written, and identify who they are (based on their previous Windows login) using the line of code above.  I don't need them to re-authenticate, because they're already a

Get Username for logged in user

I am having trouble getting a logged in username to use on an intranet site. If I use User.Identity.Name.ToString I get a blank.

 If I use Environment.UserName.ToString  I get "Network Service".

If I run the application in debug locally I get the Domain\username but not when I run it on our intranet.




System.SystemException: The trust relationship between this workstation and the primary domain faile


I posted this question in Security for Applications in Microsoft Windows, but I wasn't sure which forum is best, so I repost my question here too.

I get this trust exception on one of my users machine when he is not connected to our internal network when I call WindowsPrincipal.IsInRole.

To better understand the issue I wrote a small test-program. The test-program works without problem when he is in the office or connected via VPN, but each sid that is a domain group results in the trust exception when he isn't connected. When I run the same program on my machine and without connection to our internal network it also works without problem.

I have extract the issue into a small program and this is all the code:

    public partial class Form1 : Form
        WindowsIdentity user = WindowsIdentity.GetCurrent();


sharepoint 2007 showing System Account instead of Username / full name

When i login with my username & password into sharepoint (2007) site, it displays as a "System Account" instead of my username or my full name on the top right corner of the website. What ever changes i make inside the site, for example upload a file, post a comment, sharepoint marks it as a System account instead of my name.

Can someone help me figure it out why ?


How to get Clients Machine User credentials Username and Domain


I am trying to retrieve the loged in userName and Domain of the Clients machine. 

 string IP = (string)Request.ServerVariables["REMOTE_ADDR"];

 string IP = (string)Request.ServerVariables["REMOTE_ADDR"];

   Able to retrieve the Clients Machine IP but need to get the Remote Computer User details.


To find windows domain name and username in sql server


Hi experts,

 Any one pls tel  me the query to find the current working domain name with username in sql server.



Query to find the domain and username


Hi experts,

 Any one pls tel  me the query to find the current working domain name with username in sql server.



FAST Search Server 2010 Config Error - ValidationException 1034: Username or domain is incorrect.



I've seen other related threads and I've tried all the tricks in getting through the post-setup configuration, but I can't get by the "ValidationException 1034: Username or domain is incorrect." error message taken from the FAST psconfig log. I've tried both the wizard and the psconfig, but get the same results. I'm attempting to deploy the single server (stand-alone) on a single x64 box, under ws2008 SP2, w/SP2010, the server is also the domain controller, and i've been passing the FQDN to the post-setup script as described in the FAST deployment document (see log below):

Verbose [1] PostSetupUI - Displaying next panel :Enter the user name and password
Verbose [1] PostSetupUI - Displaying button set to the default settings
Verbose [1] PostSetupUI - Next button clicked
Verbose [1] PostSetupUI - Starting to process form data of panel :Enter the user name and password
Verbose [1] PostSetupUI - Collecting input parameters from the text input controllers.
Verbose [1] PostSetupUI - Collecting value:dev.devnet.com\fastuser of input parameter: userName
Verbose [1] PostSetupUI - Adding config parameter: userName for the next validation parameter batch
Verbose [1] PostSetupUI - Collecting value of input parameter: password
Verbose [1] PostSetupUI - Adding config parameter: password for the ne

ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend