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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T18:06:55+00:00 2026-06-08T18:06:55+00:00

I already tried link from stackoverflow I have a silverlight client and wcf service.

  • 0

I already tried link from stackoverflow

I have a silverlight client and wcf service. The application has 3 authentication modes

  1. Active Directory
  2. Windows Pass Through
  3. Proprietary – I don’t have a problem with this one obviously.
    (I really don’t know what is the difference between active directory and Window Pass Through. I just use the same code for both, except for windows pass through I get the current user and for AD the app prompts for username password)

.

private string GetCurrentUser()
{
    try
    {
        string result = WindowsIdentity.GetCurrent().Name;
        WindowsPrincipal wp = new WindowsPrincipal(WindowsIdentity.GetCurrent());
        result = wp.Identity.Name;
        if (result.Contains(@"\"))
        {
            int position = result.LastIndexOf(@"\") + 1;
            result = result.Substring(position);
        }
        return result;
    }
    catch (Exception ex)
    {
        return "";
    }
}

Both WindowsIdentity and WindowsPrincipal returns ‘DefaultAppPool’ or whatever the AppPool the current thread runs. Even Environment.UserName returns the same.

When I turn on <identity impersonate ="true"/> in web.config the silverlight client fails to connect to wcf. It gets a ‘Not Found’ error. So, I need to keep <identity impersonate ="false"/>

All I need is the current logged on user, I didn’t know that it’s this difficult.

  • 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-08T18:06:56+00:00Added an answer on June 8, 2026 at 6:06 pm

    I changed the identity on the Application Pool to my own user account and it worked.

    1. Open IIS Console
    2. Select Application Pools.
    3. Select the AppPool (in my case it was DefaultAppPool).
    4. On the right pane click Advanced Settings.
    5. There are different categories of settings like General, CPU, Process Model.
    6. Under Process Model -> Identity click the right side input box, a button shows up, click it.
    7. It opens a dialog box with 2 radio buttons (Built-in account and Custom account).
    8. Select custom account and hit Set.
    9. Set Credentials dialog box opens.
    10. Enter your credentials and hit okay. You may have to enter [domain][user name]
    11. Hit Ok to all the dialog boxes to close everything.
    12. Now test your app, WindowsIdentity.GetCurrent().Name should return the username associated with the Application Pool.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have already tried multiple ways. defaults write com.apple.Xcode PBXCustomTemplateMacroDefinitions '{ORGANIZATIONNAME=YourNameHere;}' Also i've tried
Is there anyone who has already tried to use the Microsoft Bing translator web
i seem to have some trouble installing autopy.h https://github.com/msanders/autopy/#introduction i already tried the installation
I cannot import a maven project with WTP features enabled. I have already tried:
Can I disable the minimize button in JFrame? I have already tried setUndecorated() and
I have inside a fancybox box is already opened the next link: <%= link_to
I am trying to link pion network library 4.0.3 in my application. I tried
I have tried to find this online but without much luck. Stackoverflow also does
I already tried getting the current URL of my UIWebView with: webview.request.URL . Unfortunately
http://github.com/gabriel/yajl-objc I've already tried SBJSON, and while it works, I'm looking into alternative options

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.