next chapter. The anonymous ID can be used automatically in that situation!By default, the generation of an anonymous user ID is deactivated. Activation through the web.config configuration file is similar to the following:
<?xml version="1.0"?>
<configuration>
<system.web>
<anonymousIdentification
enabled="true"
/>
</system.web>
</configuration>
By means of additional parameters, you can specify the cookie to be used. You may as well change the expiration time, which is set to 100,000 minutes as a standard (with sliding expiration). Additionally, you may define whether the ID should be saved in a cookie or in the URL. When using the setting UseDeviceProfile, this will depend on the utilized device/browser.
Please keep in mind that the user is displayed as not logged on while the anonymous ID is used. Consequently, the ID can't be queried by the allocated IIdentity object. Instead, the ID is accessible via the AnonymousId property of the HttpRequest class. The ID is delivered as a GUID that has been transformed into the following string by the Request.AnonymousId property (see Figure 6-13):
... = this.Request.AnonymousId

Figure 6-13: ASP.NET automatically generates an anonymous user ID.
Tip | The storage of anonymous user data will be described in detail in Chapter 7. |