bobek
bobek

Reputation: 8020

asp.net mvc 3 global variables without cookies

I have a asp.net mvc 3 mobile application, and by default most of the smartphones have cookies disabled. I need to use some global variables and on desktop version of the site I used cookies to do that. Is there a cookie-less way to store data in session? I've heard of Session Variables but aren't those using cookies as well?

Upvotes: 0

Views: 708

Answers (3)

linkerro
linkerro

Reputation: 5458

Cookieless sessions should do the trick for you.

<sessionState cookieless="true" />

More info on the concept here: http://msdn.microsoft.com/en-us/library/aa479314.aspx

Upvotes: 2

Nick Bork
Nick Bork

Reputation: 4841

You could use a parameter in the URL to define a session ID , like http://www.mysite.com/m/{SessionID}/{controller}/{action}/{id} where "m" defines the mobile version of your site and your unique session ID was stored in the URL. All of your ActionLinks would auto-include them.

You would need to store information about the session in some storage on the server (Database, Filesystem, Application Cache).

Upvotes: 0

Justin Helgerson
Justin Helgerson

Reputation: 25521

If your objects aren't user specific you could use caching. If they are user specific, then you will either need to use cookies or include the session id in the request URI. Doing this does open your application up to session hijacking which can be a security risk depending on how your application works.

Upvotes: 0

Related Questions