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

The Archive Base Latest Questions

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

I am running a webpage that needs to be able to read the login

  • 0

I am running a webpage that needs to be able to read the login id of the current user. Here is the code I am using:

string id = System.Security.Principal.WindowsIdentity.GetCurrent().Name;

Currently this returns the correct login but when I use it in this method:

protected Boolean isPageOwner()
{
    string id = System.Security.Principal.WindowsIdentity.GetCurrent().Name;
    alert("User: " + id);
    if (id.Equals(pageOwnerID))
    {
        return true;
    }
    if (accessPermission.ContainsKey(id))
    {
        return true;
    }
    return false;
}

the method returns false even though the id returned is identical to pageOwnerID. I’m really not sure which part of this I am having a problem with.

On a side note, my login id is of the form string1/string2 but the code retrieves it as string1 + string2 without the slash.

Any advice is appreciated.

Regards.

  • 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-08T06:08:21+00:00Added an answer on June 8, 2026 at 6:08 am

    Try using this to retrieve the username….

    if (System.Web.HttpContext.Current.User.Identity.IsAuthenticated)
    {
       string username = System.Web.HttpContext.Current.User.Identity.Name;
    }
    

    It sounds like windows authentication is not being used – you need to disable anonymous access and enable windows integrated security.

    Add this to your web.config…

    <system.web>
     <authentication mode="Windows"/>
      <authorization>
        <deny users="?"/> 
      </authorization>
    </system.web>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a script running watir-webdriver(using Firefox 4.0) that needs to access a web
Running my script through Devel::NYTProf showed that the following portion of code took up
I need to read the in memory HTML of a webpage that is displayed
I have a long running task that I need to implement on a webpage.
I currently have some code which needs to perform multiple updates per user for
I need to be able to detect if my webpage is running on a
I have a webpage that has many user-generated elements that need to be cleaned
I have a decent sized chunk of .NET code that now needs to be
I'm running a web page that has a SL 'box' in it. I know
In IIS 6.0 running on a server 2003 r2 the default webpage can't be

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.