Split and get rid of

Posted on 2010-09-02
Medium Priority
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 2000 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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
An ASP.NET Web Form User Control is not newly introduced in ASP.NET. In fact, it was an old technology yet still playing a role to generate web content, especially when we want to use it to have a better and easy way to control part of the web conte…
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…
Watch the video to know how one can repair corrupt Exchange OST file effortlessly and convert OST emails to MS Outlook PST file format by using Kernel for OST to PST converter tool. It can convert OST to MSG, MBOX, EML to access them. It can migrate…

590 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