Sunday, June 19, 2011

automatically detect the language set in the user's browser

Q. How can a page automatically detect the language set in the user's browser ?
Automatic detection of the language preference of the user as set in his browser
In your web.config file, you need to set the following globalization tag with the values that are presented below:
          enableClientBasedCulture="true" />

New features in .Net 4.0

1. ASP.NET 4.0 comes with a new option for compressing the Session data with Out Process Session mode(mode=StateServer). To enable this functionality, we need to add “compressionEnabled=”true” attribute with the SessionMode in web.config.
When Compression mode is enabled in web.config, ASP.NET compresses the serialized session data and passes it to session storage and while retrieving same deserialization and decompression happens in the server side. ASP.NET 4.0 used System.IO.Compression.GZStream class to compress the session mode.

2. We can programmatically change Session State Behavior when required as below:

 //The Session State behaviour can be any of: Default,Disabled,ReadOnly,Required based on the requirement.

HttpContext.Current.SetSessionStateBehavior( System.Web.SessionState.SessionStateBehavior.Default)