Solved

Split and get rid of

Posted on 2010-09-02
4
288 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 74

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 74

Expert Comment

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

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Welcome my friends to the second instalment and follow-up to our Minify and Concatenate Your Scripts and Stylesheets (http://www.experts-exchange.com/Programming/Languages/.NET/ASP.NET/A_4334-Minify-and-Concatenate-Your-Scripts-and-Stylesheets.html)…
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.
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

747 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

10 Experts available now in Live!

Get 1:1 Help Now