WebService Sessions
-
In my ASP.NET project I have some aspx pages and a webservice(asmx) which get called with ASP.NET AJAX. Now the aspx pages just check for session to get the logged in persons username(for relevant SQL calls) but I had trouble doing the same with my asmx file. I tried a couple different methods after searching but most results are for getting sessions in an ashx file, and the same principals dont work. So what I did was create a public string in my webservice that, on logging in, the aspx page changed to the users name. But then when I checked username it was always just the last person that had logged in, for obvious reasons. So how do I check for sessions in an asmx page? Thanks alot :)
Strive to be humble enough to take advice, and confident enough to do something about it.
-
In my ASP.NET project I have some aspx pages and a webservice(asmx) which get called with ASP.NET AJAX. Now the aspx pages just check for session to get the logged in persons username(for relevant SQL calls) but I had trouble doing the same with my asmx file. I tried a couple different methods after searching but most results are for getting sessions in an ashx file, and the same principals dont work. So what I did was create a public string in my webservice that, on logging in, the aspx page changed to the users name. But then when I checked username it was always just the last person that had logged in, for obvious reasons. So how do I check for sessions in an asmx page? Thanks alot :)
Strive to be humble enough to take advice, and confident enough to do something about it.
You need to enable sessions in your webservice..
[WebMethod(EnableSession = true)]
public bool HelloWorld()
{
return true;
}.: I love it when a plan comes together :. http://www.zonderpunt.nl
-
In my ASP.NET project I have some aspx pages and a webservice(asmx) which get called with ASP.NET AJAX. Now the aspx pages just check for session to get the logged in persons username(for relevant SQL calls) but I had trouble doing the same with my asmx file. I tried a couple different methods after searching but most results are for getting sessions in an ashx file, and the same principals dont work. So what I did was create a public string in my webservice that, on logging in, the aspx page changed to the users name. But then when I checked username it was always just the last person that had logged in, for obvious reasons. So how do I check for sessions in an asmx page? Thanks alot :)
Strive to be humble enough to take advice, and confident enough to do something about it.
Have a look into this : Maintaining Session from the Client Application to the Web Service[^]
Abhijit Jana | Codeproject MVP Web Site : abhijitjana.net Don't forget to click "Good Answer" on the post(s) that helped you.