I have a session value and a function in a apsx.cs page and I am using jquery webmethod to insert data into database.
Now i want to access session value and function in webmethod but it gives some error.
Below is my Page load code:
int nUserId = Convert.ToInt16(Session["UId"]);
And a Function :
public int CalcUser()
{
return Convert.ToInt16(Session["UId"]) * 2;
}
Now below is my Webmethod:
[WebMethod]
public static void Save()
{
UserInfo objUser = new UserInfo();
objUser.Useid = Convert.ToInt16(Session["UId"]);
objUser.CalcUser = CalcUser();
... Save into Database
}
So how can I use session value and function in webmwthod.
Thanks