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

T

Tim Mackey

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.
 

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. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top