Search code examples
java.netweb-servicessessionsession-management

session management in web services?


is it possible to manage sessions in web-services? if yes, how to manage session in it? is it similar to sessions we maintain in JSP or PHP? where does the info about the session will be stored, Client or Server?


Solution

  • Is it java or .net question?

    In .net you can easily use session state on webservice hosting server by setting EnableSession parameter in WebMethod attribute, for example:

    [WebMethod(EnableSession = true)]
    public bool Login(string login, string password)
    {
        // you can use session here so for example log in user
        if(login = "administrator" && password = "secret")
           Session["authorizedUser"] = login;
    }