If cookies are disabled then how to save data in C # .net

If cookies are disabled in the browser, then how can we save the data the next time the user logs in. e.g. for login page, how to save username, cookies are disabled?

0


source to share


1 answer


You can use cookieless sessions to store session data. This function injects the session id into the url, not into the cookie.

Alternatively, you can use Asp.net profile properties to store profile data for a user. The profile is stored by the user and can be retrieved when the user logs on to the system.

It's pretty easy to use:



  • First, you set up your profile properties in the web.config file.
  • Then you set the profile properties where needed, for example when the user changes their settings. This is done using the static Profile class. It has member properties for all profile properties that you add.
  • Finally, you read the properties of the profile when you need them by reading the properties.
  • No save or load required - this is done automatically by asp.net when the user logs in and out.

Check the MSDN library and search for Profile Properties or look here .

One note. The default profile property provider stores all profile values ​​in a single table column. This column contains all of the values ​​added together in a row. This is fine in some cases because it is a simple and efficient way to store data, but you can write your own profile provider that stores data in a more appropriate way.

+2


source







All Articles