Asked by:
Cookies on Mobile Devices

Question
-
User802589610 posted
How dow we make sure that cookies are correctly set on various Mobile Phones and Mobile devices.
We are using Asp.Net ver 2.0
Monday, May 28, 2007 9:22 AM
All replies
-
User1634317999 posted
For which purpose do you need cookies?
Monday, May 28, 2007 10:32 AM -
User802589610 posted
We need to recognize a user who has already visited our Mobile/WAP site earlier and not ask the user to login everytime.
Monday, May 28, 2007 10:43 AM -
User1634317999 posted
I would suggest not to use cookies for authentication if this does not conflict with other requirements of your application. You have to set the cookieless attribute of the SessionState element in the Web.config file to true. Otherwise if you have only devices with cookie support you have to make sure that they are configured appropriate.
Monday, May 28, 2007 12:23 PM -
User802589610 posted
We would like to set the location value for each user so that relevant information is displayed. It is not for authentication.
We only want cookies to be set when the device allows it. We had modified the web.config accordingly for cookieless=false but the cookies are not getting set on mobile devices. How do we make sure that the cookie has been set properly. Also is there any limitation for the key value, length etc. for Mobile devices
Monday, May 28, 2007 1:51 PM -
User1634317999 posted
Some mobile devices do not allow multiple values for cookies. Therefore you have to use a separate cookie for each value.
Monday, May 28, 2007 2:07 PM -
User802589610 posted
Our problem is that even when the device allows cookies, the location value (single key) is also not getting set. What would be the correct way or code to set the cookie on Mobiles? Is it any different from the Web?
Monday, May 28, 2007 2:15 PM -
User1634317999 posted
There is no difference between web and mobile applications concerning the writing of cookies.
Are you testing with emulators on localhost or real devices? If you use an emulator under localhost cookies might not be set. Perhaps you can show your code and it would be helpfull to know something about your concept. Do you want to store a GPS Location in a cookie?
Tuesday, May 29, 2007 2:28 AM -
User802589610 posted
We are testing with real devices, but the cookies are not getting set.
ctrCookie = New HttpCookie("mv")
ctrCookie.Value = "DL"
ctrCookie.Expires = System.DateTime.MaxValue
Response.Cookies.Add(ctrCookie)
How can we get the GPS location?
Tuesday, May 29, 2007 3:22 AM -
User1634317999 posted
If you do not mean the GPS location what kind of "location" do you mean?
I am not sure if the value corresponding to System.DateTime.MaxValue in your code, i. e. 23:59:59.9999999, December 31, 9999 , will be accepted by mobile browsers.
You can also post your URL or send me the link so that we can see what the server is sending to the client.
Tuesday, May 29, 2007 3:41 AM -
User802589610 posted
By authentication we mean that "all we need to know is that this user has visited earlier". Also location here means the city the user selects from the website once & thereafter all information for that city is made default for the user. If we can store GPS location that would be even better. We would try changing the System.DateTime.MaxValue and then test as you suggested
Tuesday, May 29, 2007 11:32 AM -
User1634317999 posted
The WAP Gateway or Proxy has also to support cookies.
GPS location is only available with special phones and special services.
Monday, June 4, 2007 8:26 AM