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 3598894
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T20:17:58+00:00 2026-05-18T20:17:58+00:00

Thanks for reading and for your thoughts; this is a hairy problem, so I

  • 0

Thanks for reading and for your thoughts; this is a hairy problem, so I thought I’d share to see if it is actually a fair challenge for more seasoned developers than ourselves.

We’re developing a web application for a corporate Microsoft Active Directory environment, and we use Windows Authentication provided by IIS to authenticate users for single-sign-on, alongside Forms Authentication. I know IIS complains when both are enabled, but it works very well, and every site we’ve deployed at has had no weird quirks to work around – until now.

The new site has “shared” machines, logged in permanently with a generic account that has read-only access to the applications they need to use. This means that we can’t differentiate between users who should have different permissions to the application; we need some way of prompting the user for authentication details.

First try was some serious googling; nobody else in the world seemed to have our problem except for a few misguided souls who had asked questions into the ether and received no response.

After a bit of brainstorming and nutting out the way IIS’s authentication works, it seemed that the most straightforward way to approach the problem was to issue a 401 Unauthorized in response to a user known to be a shared account. Initial tests here seemed fruitful, yielding successful changes of username inside the browser, however a prototype at the site did not prompt for credentials, and the browser kept the same account details. We also hit on the IE-specific javascript

document.execCommand("ClearAuthenticationCache")

which, again, worked in the lab but not onsite. Further experiments with IE security settings onsite revealed that the browser would automatically reauthenticate if the webapp site was excluded from the Intranet Zone, regardless of the method used to trick the browser into prompting the user for new account details.

Now we’re stuck. We’ve got workaround options for getting it going on time, but they’re definitely not the “right” answers:

  • require users to log out of the shared account before logging into our app (…yuck)
  • exclude our webapp from Intranet Zone on all machines
  • provide a non-SSO login service for users

I’m convinced that there’s a canonical way to do this – a known pattern, a common base problem that’s already been solved, something like that – and I’m very interested to hear what sort of inventive methods there are to solve this sort of problem, and if anyone else has actually ever experienced anything remotely like 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-18T20:17:59+00:00Added an answer on May 18, 2026 at 8:17 pm

    We ended up settling on a solution that submits a query to the LDAP directory the server knows about. It means having to accept the user’s password, but no other solution was solid enough to run in a production environment.

    Hopefully this helps someone. .NET Framework 3.5+ required.

    using System.DirectoryServices.AccountManagement;
    
    private static bool IsLdapAuthenticated(string username, string password)
    {
        PrincipalContext context;
        UserPrincipal principal;
    
        try
        {
            context = new PrincipalContext(ContextType.Domain);
            principal = Principal.FindByIdentity(context, IdentityType.SamAccountName, username) as UserPrincipal;
        }
        catch (Exception ex)
        {
            // handle server failure / user not found / etc
        }
    
        return context.ValidateCredentials(principal.UserPrincipalName, password);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Thanks for reading and for your thoughts; this is a hairy problem, so I
WHY?! ... Maybe that's your first thought when reading the headline of this topic.
thanks for your reading. I am trying to modify Jquery Nivo Zoom plugin to
Thanks for reading this. I have no idea why this is throwing a NullReferenceException
Firs of all thanks for reading this. I'm having trouble updating the progress from
Thanks in Advance for reading and answer this question. I got button in asp
Thanks for reading. I have done a search, read multiple posts (lost count) and
Thanks to reading about error handling on StackOverflow , I discovered Mz-Tools. However, I
Hello and thanks to everyone for reading my question. I've been working on a
thank you for reading. For a shell command to wget, something like this works:

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.