create cookie in web method

Posted by quantum62 on Stack Overflow See other posts from Stack Overflow or by quantum62
Published on 2012-09-16T07:41:56Z Indexed on 2012/09/16 9:38 UTC
Read the original article Hit count: 286

Filed under:
|
|
|
|

i have a web method that check user in data base via a jquery-ajax method i wanna if client exists in db i create a cookie in client side with user name but i know that response is not available in staticmethod .how can i create a cookie in a method that call with jquery ajax and must be static. its my code that does not work cuz response is not accesible

 if (olduser.Trim() == username.Trim() && password.Trim()==oldpass.Trim())
        { retval =olduser;

        HttpContext context = HttpContext.Current;
        context.Session[retval.ToString()] = retval.ToString();
        HttpCookie cook = new HttpCookie("userath");
        cook["submituser"] = "undifiend";
        Response.Cookies.Add(cook);

       }

© Stack Overflow or respective owner

Related posts about c#

Related posts about jQuery