Split and get rid of

Posted on 2010-09-02
Last Modified: 2013-12-17
I captured the windows Identity and need to take off the domain name before I write it to the database.
The results of the following code are DOMAIN\r3nder - I need it to be just r3nder
I am sure its easy I just cant find the way to Split it

WindowsIdentity currIdentity = WindowsIdentity.GetCurrent();
string NtAccountName = currIdentity.Name;

Open in new window

Question by:r3nder
  • 2
LVL 75

Accepted Solution

käµfm³d   👽 earned 500 total points
ID: 33588492

string NtAccountName = currIdentity.Name.Substring(currIdentity.Name.IndexOf("\\") + 1);

Open in new window


Expert Comment

ID: 33588545
or something like:


Author Closing Comment

ID: 33588582
you are the bomb Kaufmed = as usual!!!
LVL 75

Expert Comment

by:käµfm³d 👽
ID: 33588963
Glad to help...   as usual   :D

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
In this video I am going to show you how to back up and restore Office 365 mailboxes using CodeTwo Backup for Office 365. Learn more about the tool used in this video here: (…

912 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now