How do i return a Userid in web method and use that returned result in website ASP.NET,make it session variable in order to use it on different webpages in ASP.NET?
[WebMethod]
public bool UserLogin(string EmailAdd, string Password)
{
SqlConnection myConnection = new SqlConnection(@"user id=BankUser;password=Computer1;server=(local)\sql2008;database=BillionBank;");
myConnection.Open();
SqlCommand myCommand = new SqlCommand("SELECT * FROM [BillionBank].[dbo].[tblCustomerProfile] WHERE EmailAdd='" + EmailAdd + "' AND Password ='" + Password + "'", myConnection);
SqlDataReader myreader;
myreader = myCommand.ExecuteReader();
if (myreader.Read())
{
return true;
}
else
return false;
}
this is my code i want to return a Userid as a result and use it in website as a session variables,when am calling the web method in my website
1 Answer