Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Jul 15, 2012 04:42 PM by roopeshreddy
Jul 15, 2012 12:41 PM|LINK
I'm a developer of both IOS (novice) and ASP.NET. Now I have a problem with such kinds of issue.
My IPhone application try to connect to a ASP.NET website, then sends login and password my method GET, of course, via HTTP Request. Then C# on the server will treat the request, which code is as follows:
string userName = (string)Request["UserName"];
string password = (string)Request["Password"];
var userIdRes = usersAdapter.VerifyLogin(userName, password);
if (userIdRes.Count == 1)
Session["CurrentUserId"] = userIdRes.Id;
So once the login succeed, A session is opened for my client IPhone. Just after login, my Objective C sends the next HTTP Request for getting a list, which is treated by the following C# server program in another method:
if (Session["CurrentUserId"] == null)
Response.Write("ERROR: SESSION EXPIRED");
//Do anything else......
Here is my problem. Session["CurrentUserId"] was just set a value a few seconds ago by the first program, but here it is reported to be null and my IPhone application receive each time the string from ASP.NET server "ERROR: SESSION EXPIRED"
What is strange is that, this problem never happens when I simulate the same HTTP request via a normal web browser of any type (IE, Firefox, Safari...), it works perfectly, this problem seems to occor only on my IPhone native application
in Objective C.
I understand that the ASP.NET use cookie automatically. Here
the ASP.NET server seems to create a new Session each time my IPhone application send a HTTP request ? Is there anyone who knows how to do so that my application IPhone can profit the Session like a web browser ?
Jul 15, 2012 04:26 PM|LINK
i guess there is a problem with the cookies and iPhone, so server is not isn't able to get back the seessionID
Jul 15, 2012 04:42 PM|LINK
Is cookies enables in the Settings of iPhone? If not, try enabling it and try again!
Hope it helps u...