Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What's the use for FormsAuthenticationTicket.Version property?

As I was going through creating my authentication mechanism in an application when I stumbled upon the FormsAuthenticationTicket.Version property. The docs do not exemplify any use case and I found no reference for it's use anywhere else.

Did anyone use it already?

Thanks

like image 750
tucaz Avatar asked Oct 29 '12 21:10

tucaz


People also ask

What is FormsAuthenticationTicket?

FormsAuthenticationTicket(Int32, String, DateTime, DateTime, Boolean, String, String) Initializes a new instance of the FormsAuthenticationTicket class with cookie name, version, directory path, issue date, expiration date, persistence, and user-defined data.

What is the use of FormsAuthentication SetAuthCookie?

The SetAuthCookie method adds a forms-authentication ticket to either the cookies collection or the URL if CookiesSupported is false . The forms-authentication ticket supplies forms-authentication information to the next request made by the browser.

What is Aspxauth cookie?

The ASPXAUTH cookie is used to determine if a user is authenticated. As far as the location of the cookie, that depends on your browser. If you are using Firefox you can view the cookie by clicking on Tools -> Options -> Privacy. Then scroll down to the domain and expand it to see the cookie and its value.


1 Answers

This was created for future use, so it can transpose tickets of a previous version to the current. In .NET 1.1, the default value is 1. Starting with .NET 2.0, the default value is 2. Unless, of course, you override this value when constructing a ticket manually.

The framework doesn't really do anything with this value currently. You could use it yourself (and specify your own "version") to understand the data contained in a ticket as your application evolves and deals with persistent cookies, but mostly, you'll probably just ignore it.

like image 97
moribvndvs Avatar answered Oct 13 '22 00:10

moribvndvs