Solved

Split and get rid of

Posted on 2010-09-02
4
297 Views
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

0
Comment
Question by:r3nder
  • 2
4 Comments
 
LVL 75

Accepted Solution

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

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

Open in new window

0
 
LVL 7

Expert Comment

by:mquiroz
ID: 33588545
or something like:

NtAccountName.Split('\\')[1]
0
 
LVL 6

Author Closing Comment

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

Expert Comment

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

Featured Post

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

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

Suggested Solutions

Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

809 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