How to configure session state to use AutoDetect in ASP.NET

Software developer can configure session state through web.config file for his current application (which is found in the same virtual directory as the .aspx web page files). UseDeviceProfile is the one of possible modes for HttpCookieMode. When this mode is set ASP.NET attempts to determine whether the browser supports cookies by attempting to set and retrieve a cookie. This technique can correctly determine whether a browser supports cookies but has them disabled, in which case cookieless mode is used instead.