how to persist a user identity across a web service session context

Discussion in 'ASP .Net Security' started by Tim Mackey, Jun 3, 2004.

  1. Tim Mackey

    Tim Mackey Guest

    hi,
    i'm using a simple web service authentication method (not WSE). the problem
    is that when i set a generic principal on the Context.User object, it is
    lost by the time the next call is made by the client on the same web service
    object.

    the winforms client first calls the login method, which does the following
    if the username/pwd is correct:

    GenericIdentity id = new GenericIdentity(username, "CustomAuth");
    Context.User = new GenericPrincipal(id, new string[]{"MyAppClients"});

    then for every other method called in the web service, i call the following
    method to make sure that the client has already logged in:

    private bool authenticate()
    {
    if(Context.User.IsInRole("MyAppClients"))
    return true;
    else
    return false;
    }

    i debugged the code and the Context.User is correctly set at the end of the
    login method, but is always reset for subsequent calls. why does this
    happen? i thought the web service session would preserve any changes i made
    to the Context.user.

    thanks for any help
    tim mackey.
    --------------------------
    67d0ebfec70e8db3
     
    Tim Mackey, Jun 3, 2004
    #1
    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. Giovanni Bassi
    Replies:
    0
    Views:
    651
    Giovanni Bassi
    Oct 20, 2003
  2. nalbayo
    Replies:
    2
    Views:
    5,507
    Bruce Barker
    Nov 11, 2005
  3. Frederick D'hont
    Replies:
    0
    Views:
    313
    Frederick D'hont
    Jul 25, 2005
  4. Replies:
    6
    Views:
    456
  5. Jeffrey
    Replies:
    3
    Views:
    135
    Joe Kaplan
    Sep 27, 2007
Loading...

Share This Page