views:

33

answers:

1

Hi all, I'm writing a .NET(3.5) web service for an IPhone native app in which I need to manage users' sessions.

Question is - can I just add the [WebMethod (EnableSession = true)] attribute to my web services, and the native app (which I'm not the one who's writing and hence the ignorance) would be able to use, or should I write an implementation for the session mechanism??

And just for general knowledge - would the .NET session mechanism work if I was to write a web app instead of a native app??

Thank you!

A: 

As long as you pass the session id cookie, you should be all set.

Douglas
Could you elaborate a bit please? (-:Does a native app use the session mechanism exactly like any web page??Thank you.
Oren A
The native client will have to support cookies, just like a browser. By default the client will be sent a Set-Cookie header, which sets the ASP.NET_SessionId cookie. On subsequent requests, the native client would have to send back the cookie in the Cookie header of the web service request for the session to work, otherwise a new session will be created for each request. If the native client does not support cookies, then sessions probably won't work. (There are other ways to pass the SessionId, but if cookies don't work, the alternative probably won't work either.)
Douglas
But that's my question exactly - Do IPhone's native apps support the .NET session mechanism (in the same way as browsers and usual web services do..).Sorry if I'm not getting you..Thanks a lot for now, am waiting for your answer.
Oren A
I don't think that you can make general statements about all iPhone apps like that, it's completely up to the person writing the app what they wish to support. Certainly they *could* support session cookies, but it's up to the person writing the app.
Douglas
If the COULD I guess I can assume they WOULD.Thanks again.
Oren A