Identifying current user

Discussion in 'ASP .Net' started by Tapi, Nov 3, 2005.

  1. Tapi

    Tapi Guest

    Hello,

    I can easily get the Windows login of the current user on my machine by
    using:

    User_login = HttpContext.Current.User.Identity.Name()



    However once, I copy the aspx and corresponding files to the production
    server, the variable "User_login" is empty, i.e. the currently logged in
    user is not recognised.

    What could be the problem?



    Thanls
    Tapi, Nov 3, 2005
    #1
    1. Advertising

  2. Tapi

    Mr Newbie Guest

    You need to check the type of Authentication you have setup on the project
    on the target server and if anonymous access has been left check or not.

    Check in web.config and your IIS settings for the project on the target
    machine.

    --
    Best Regards

    The Inimitable Mr Newbie º¿º


    "Tapi" <> wrote in message
    news:...
    > Hello,
    >
    > I can easily get the Windows login of the current user on my machine by
    > using:
    >
    > User_login = HttpContext.Current.User.Identity.Name()
    >
    >
    >
    > However once, I copy the aspx and corresponding files to the production
    > server, the variable "User_login" is empty, i.e. the currently logged in
    > user is not recognised.
    >
    > What could be the problem?
    >
    >
    >
    > Thanls
    >
    >
    Mr Newbie, Nov 3, 2005
    #2
    1. Advertising

  3. Tapi

    Tapi Guest

    Anonymous is checked and the problem still exists.

    IIS settings on the target server seem to be all fine.

    "Mr Newbie" <> wrote in message
    news:...
    > You need to check the type of Authentication you have setup on the project
    > on the target server and if anonymous access has been left check or not.
    >
    > Check in web.config and your IIS settings for the project on the target
    > machine.
    >
    > --
    > Best Regards
    >
    > The Inimitable Mr Newbie º¿º
    >
    >
    > "Tapi" <> wrote in message
    > news:...
    > > Hello,
    > >
    > > I can easily get the Windows login of the current user on my machine by
    > > using:
    > >
    > > User_login = HttpContext.Current.User.Identity.Name()
    > >
    > >
    > >
    > > However once, I copy the aspx and corresponding files to the production
    > > server, the variable "User_login" is empty, i.e. the currently logged in
    > > user is not recognised.
    > >
    > > What could be the problem?
    > >
    > >
    > >
    > > Thanls
    > >
    > >

    >
    >
    Tapi, Nov 3, 2005
    #3
  4. Tapi

    Mr Newbie Guest

    But how is your authorisation set ?, are making users sign on ?

    The only other thing I can think of is if when you authenticate you dont use
    the FormsAuthentication.Redirect..... and use something else like a
    response.redirect I have seen the same thing happen.

    There hast to be a configuration issue between your machine and the server
    and the only thing which would affect this as far as I know are the
    following.

    1.) Authentication Method
    2.) Authorisation settings
    3.) Impersonation

    If you are truly athenticated you can check this using the User
    ..IsAuthenticated Or whatever property it is

    --
    Best Regards

    The Inimitable Mr Newbie º¿º


    "Tapi" <> wrote in message
    news:O9jD1$...
    > Anonymous is checked and the problem still exists.
    >
    > IIS settings on the target server seem to be all fine.
    >
    > "Mr Newbie" <> wrote in message
    > news:...
    >> You need to check the type of Authentication you have setup on the
    >> project
    >> on the target server and if anonymous access has been left check or not.
    >>
    >> Check in web.config and your IIS settings for the project on the target
    >> machine.
    >>
    >> --
    >> Best Regards
    >>
    >> The Inimitable Mr Newbie º¿º
    >>
    >>
    >> "Tapi" <> wrote in message
    >> news:...
    >> > Hello,
    >> >
    >> > I can easily get the Windows login of the current user on my machine by
    >> > using:
    >> >
    >> > User_login = HttpContext.Current.User.Identity.Name()
    >> >
    >> >
    >> >
    >> > However once, I copy the aspx and corresponding files to the production
    >> > server, the variable "User_login" is empty, i.e. the currently logged
    >> > in
    >> > user is not recognised.
    >> >
    >> > What could be the problem?
    >> >
    >> >
    >> >
    >> > Thanls
    >> >
    >> >

    >>
    >>

    >
    >
    Mr Newbie, Nov 3, 2005
    #4
  5. Tapi

    Greg Burns Guest

    > Anonymous is checked and the problem still exists.

    uncheck it!

    "Tapi" <> wrote in message
    news:O9jD1$...
    > Anonymous is checked and the problem still exists.
    >
    > IIS settings on the target server seem to be all fine.
    >
    > "Mr Newbie" <> wrote in message
    > news:...
    >> You need to check the type of Authentication you have setup on the
    >> project
    >> on the target server and if anonymous access has been left check or not.
    >>
    >> Check in web.config and your IIS settings for the project on the target
    >> machine.
    >>
    >> --
    >> Best Regards
    >>
    >> The Inimitable Mr Newbie º¿º
    >>
    >>
    >> "Tapi" <> wrote in message
    >> news:...
    >> > Hello,
    >> >
    >> > I can easily get the Windows login of the current user on my machine by
    >> > using:
    >> >
    >> > User_login = HttpContext.Current.User.Identity.Name()
    >> >
    >> >
    >> >
    >> > However once, I copy the aspx and corresponding files to the production
    >> > server, the variable "User_login" is empty, i.e. the currently logged
    >> > in
    >> > user is not recognised.
    >> >
    >> > What could be the problem?
    >> >
    >> >
    >> >
    >> > Thanls
    >> >
    >> >

    >>
    >>

    >
    >
    Greg Burns, Nov 3, 2005
    #5
  6. Tapi

    Tapi Guest

    The problem was actually because of Anonymous being checked. I was of the
    impression that I had tested the application with Anonymous unchecked, but
    no.

    Thanks everybody for your help.

    "Greg Burns" <> wrote in message
    news:...
    > > Anonymous is checked and the problem still exists.

    >
    > uncheck it!
    >
    > "Tapi" <> wrote in message
    > news:O9jD1$...
    > > Anonymous is checked and the problem still exists.
    > >
    > > IIS settings on the target server seem to be all fine.
    > >
    > > "Mr Newbie" <> wrote in message
    > > news:...
    > >> You need to check the type of Authentication you have setup on the
    > >> project
    > >> on the target server and if anonymous access has been left check or

    not.
    > >>
    > >> Check in web.config and your IIS settings for the project on the target
    > >> machine.
    > >>
    > >> --
    > >> Best Regards
    > >>
    > >> The Inimitable Mr Newbie º¿º
    > >>
    > >>
    > >> "Tapi" <> wrote in message
    > >> news:...
    > >> > Hello,
    > >> >
    > >> > I can easily get the Windows login of the current user on my machine

    by
    > >> > using:
    > >> >
    > >> > User_login = HttpContext.Current.User.Identity.Name()
    > >> >
    > >> >
    > >> >
    > >> > However once, I copy the aspx and corresponding files to the

    production
    > >> > server, the variable "User_login" is empty, i.e. the currently logged
    > >> > in
    > >> > user is not recognised.
    > >> >
    > >> > What could be the problem?
    > >> >
    > >> >
    > >> >
    > >> > Thanls
    > >> >
    > >> >
    > >>
    > >>

    > >
    > >

    >
    >
    Tapi, Nov 3, 2005
    #6
  7. For Windows Auth IIS does it for you.
    Tapi try reading through :-
    http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnbda/html/authaspdotnet.asp
    Hope that helps
    Patrick


    "Tapi" <> wrote in message
    news:...
    > The problem was actually because of Anonymous being checked. I was of the
    > impression that I had tested the application with Anonymous unchecked, but
    > no.
    >
    > Thanks everybody for your help.
    >
    > "Greg Burns" <> wrote in message
    > news:...
    > > > Anonymous is checked and the problem still exists.

    > >
    > > uncheck it!
    > >
    > > "Tapi" <> wrote in message
    > > news:O9jD1$...
    > > > Anonymous is checked and the problem still exists.
    > > >
    > > > IIS settings on the target server seem to be all fine.
    > > >
    > > > "Mr Newbie" <> wrote in message
    > > > news:...
    > > >> You need to check the type of Authentication you have setup on the
    > > >> project
    > > >> on the target server and if anonymous access has been left check or

    > not.
    > > >>
    > > >> Check in web.config and your IIS settings for the project on the

    target
    > > >> machine.
    > > >>
    > > >> --
    > > >> Best Regards
    > > >>
    > > >> The Inimitable Mr Newbie º¿º
    > > >>
    > > >>
    > > >> "Tapi" <> wrote in message
    > > >> news:...
    > > >> > Hello,
    > > >> >
    > > >> > I can easily get the Windows login of the current user on my

    machine
    > by
    > > >> > using:
    > > >> >
    > > >> > User_login = HttpContext.Current.User.Identity.Name()
    > > >> >
    > > >> >
    > > >> >
    > > >> > However once, I copy the aspx and corresponding files to the

    > production
    > > >> > server, the variable "User_login" is empty, i.e. the currently

    logged
    > > >> > in
    > > >> > user is not recognised.
    > > >> >
    > > >> > What could be the problem?
    > > >> >
    > > >> >
    > > >> >
    > > >> > Thanls
    > > >> >
    > > >> >
    > > >>
    > > >>
    > > >
    > > >

    > >
    > >

    >
    >
    Patrick.O.Ige, Nov 4, 2005
    #7
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Mike Newton
    Replies:
    0
    Views:
    2,867
    Mike Newton
    Jul 23, 2004
  2. Steve C. Orr [MVP, MCSD]
    Replies:
    0
    Views:
    1,592
    Steve C. Orr [MVP, MCSD]
    Jul 23, 2004
  3. Tapi
    Replies:
    9
    Views:
    4,085
  4. Neil
    Replies:
    0
    Views:
    329
  5. Roger Withnell

    Identifying the web site address of the current page

    Roger Withnell, Oct 4, 2003, in forum: ASP General
    Replies:
    3
    Views:
    106
    Matt Simner
    Oct 4, 2003
Loading...

Share This Page