AUTH_USER & User.Identity.Name?

Discussion in 'ASP .Net' started by Guest, Oct 1, 2004.

  1. Guest

    Guest Guest

    Hi,

    I have a dev machine, part of a domain, with a site set to Integrated
    security only. I want to determine the username of person accessing the
    page. When I run the page with the following code:

    Response.Write(Request.ServerVariables["AUTH_USER"]);
    Response.Write("<BR>");
    Response.Write(HttpContext.Current.User.Identity.Name);

    It outputs:

    DEVSERVERNAME\Administator
    DEVSERVERNAME\Administator

    but I thought it would be my username ("US" stands for our US domain):

    US\dsmith
    US\dsmith

    I took "dsmith" out of the Administrators group but I still get the
    Administrator to appear.

    Another user tested the page and she got her credentials displayed back OK.

    What am I not getting? Thanks.
     
    Guest, Oct 1, 2004
    #1
    1. Advertisements

  2. Are you one the server when you are testing it? Or are you hitting it
    remotely. The User.Indentity.Name should display the name you are logged as
    on the machine the browser is on.

    bill
     
    William F. Robertson, Jr., Oct 1, 2004
    #2
    1. Advertisements

  3. Guest

    Guest Guest

    Hi Dave,

    Are you sure that you are logged in to windows not as Administrator and
    instead with your domain account?


    Ethem Azun
     
    Guest, Oct 1, 2004
    #3
  4. Guest

    Guest Guest

    That's what's weird. I'm browsing it from my desktop and logged in with my
    domain account.

     
    Guest, Oct 1, 2004
    #4
  5. That is really strange...I have thought of a couple things to try out.

    Add the following section to your web.config on the dev server.
    <authorization>
    <allow users="us\dsmith" />
    <deny users="*" />
    </authorization>

    It should prompt you for a login box since it is trying to authenticate you
    as devserver/administrator. Try to login with your us/dsmith login on the
    box and see what happens.

    Are you using impersonation on the server?

    The identity sent to the webserver comes from the browser settings. It is
    at all possible that you have logged in and chose to save password in the
    past. Perhaps your IE has cached the username/password and it resending it
    to the server.

    If this is possibly the case, maybe you could try reseting the administrator
    password on your dev server. That way if any user/pass has been cached, it
    will fail and prompt you for the login box.

    Just shooting in the dark here.

    HTH,
    bill


     
    William F. Robertson, Jr., Oct 1, 2004
    #5
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.