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

  • SEARCH
  • Home
  • 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 8952761
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T13:56:45+00:00 2026-06-15T13:56:45+00:00

I have a C# application that will use corporate Active Directory for authentication for

  • 0

I have a C# application that will use corporate Active Directory for authentication for half the users and a custom authentication method for the other half.

I already managed to authenticate users in AD using DirectoryEntry, DirectorySearcher, etc. and also have my custom authentication working.

However, I want to know if a user has already been logged in his computer using the corporate domain, then that user won’t be shown any Logon form and has to pass to the application.

I know I can use WindowsIdentity.GetCurrent().IsAuthenticated, but that returns “true” for both the locally logged users and the Domain logged users.

I want to know how can I tell apart the first from the latest.

(Note: this is a desktop application)

  • 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-06-15T13:56:47+00:00Added an answer on June 15, 2026 at 1:56 pm

    I also maintain a winforms desktop application that uses active-directory for in office users and supports non-office users as well.

    This may be more then your asking for but since I have the same scenario as you I’m going to offer it anyway because it came together in a kind of a nice way, where I really didn’t write too much code and has been working well.

    I’m sure others might have done this with a package as opposed to rolling their own – and to be honest I will probably go that route the next time I have this requirement…

    Here it is:

    Conceptually I took a cue from ASP.NET and broke security into two logical pieces:

    Authentication – Who is this user?

    Authorization – Can the user do this?

    My implementation uses a simple database:

    enter image description here

    Here’s a snippett from the main form of my application:

        public EOMForm()
        {
            InitializeComponent();
    
            // Show the connection string when hovering over the database label (Test Mode Only)
            if(Properties.Settings.Default.TestMode)
                this.toolTip1.SetToolTip(this.databaseLabel, EomAppCommon.EomAppSettings.ConnStr);
    
            // Security
            DisableMenus();
        }
    
        private void DisableMenus()
        {
            // Disable individual menu items
            foreach (var menuItem in this.TaggedToolStripMenuItems())
                menuItem.Enabled = Security.User.Current.CanDoMenuItem((string)menuItem.Tag);
    
            // Apply disabled color to top level menus that have all their items disabled
            foreach (var menu in menuStrip1.DisabledMenus())
                menu.ForeColor = SystemColors.GrayText;
        }
    

    And here’s the supporting utility code.

    Finally, I administer it with with an ASP.NET scaffold site:

    enter image description here

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

Sidebar

Related Questions

I have this application that will recurse all folders in a given directory and
I have an application that will mail users attachments of text files. Receiving users
We have an application that will capture different images from users and make them
I have an application that will use Core Data. I've added the Core Data
A little back story : I have small application that will use Word to
I have an application that will be accessing the web. I've decided to use
I have an application that will use flask and mongodb; I will probably host
I'm creating a web application that will use multiple types of users (e.g. Admin,
I have a form in my ASP.NET MVC 3 application that will use jquery
I'm designing an application that will use Oracle , and we have this department

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.