Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 911693
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T17:15:13+00:00 2026-05-15T17:15:13+00:00

We allow our users to enter Active Directory account information using either an NT

  • 0

We allow our users to enter Active Directory account information using either an NT account name (domain\account) or a UPN (account@email,xxx). I would like to write some code to validate the account in active directory before allowing the user to move on. Note, we are not validating a password, just the account name.

I can use UserPrincipal.FindByIdentity, however, this expects only a user name.

Can I validate the account name in either format using .NET? Or am I relegated to parsing out out the domain from the account name to validate both parts of the user input? The later would be a bit messy, woudln’t it?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T17:15:14+00:00Added an answer on May 15, 2026 at 5:15 pm

    Attempt to create a WindowsIdentity from the UPN:

    WindowsIdentity wi = new WindowsIdentity("alias@example.com");
    

    It will succeed for an UPN valid in AD, throw an exception for invalid ones. The process validating the UPN must be connected to the AD and have proper access rights (ie. no anonimization due to delegation constraint on an impersonated context).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Our CMS allows users to enter text using a html editor, so when reading
I'm trying to allow my users to enter in large lists of data using
We allow users to add domains to an active record model such as User.domain
I am programming a control to allow the users of our intranet to upload
I just picked up the Google API today to allow some users of our
I have a requirement to allow users to browse directories on our file server,
In our application, we allow user's to write their Bio using a WYSIWYG editor,
We have a content management system to allow our users to store files uploaded
We have a high security application and we want to allow users to enter
We allow users of our website to place the Facebook comments social gadget on

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.