Skip to main content

Posts

Showing posts from September, 2010

LINQ - some useful links

I have mentioned below some useful links on LINQ. http://weblogs.asp.net/scottgu/archive/2007/05/19/using-linq-to-sql-part-1.aspx http://weblogs.asp.net/scottgu/archive/2006/08/27/Slides-_2B00_-Samples-Posted-from-my-TechEd-LINQ-Talk.aspx http://blogs.msdn.com/b/ukadc/archive/2010/04/27/what-on-earth-is-a-lambda-expression.aspx Hope this helps.

Find Cultureinfo and RegionInfo from browser in ASP.NET

Get language and country from a browser in ASP.NET by Mads Kristensen I recently had the challenge of retrieving a country based on the browser language. It was used to pre-select a country in a drop down list so the user didn’t have to. I knew it wasn’t going to be 100% accurate but probably more like 80-90%. That’s because some people change the browser language instead of their native language and others use a non-ISO standard language. And last, some clients just don’t send language information. It wasn’t an option to use a database that mapped IP addresses to countries, so the country had to be resolved from the browser alone. Resolve the culture I decided to split the functionality up into two methods. The first one resolves the CultureInfo based on the browsers language.   public static CultureInfo ResolveCulture() {   string [] languages = HttpContext .Current.Request.UserLanguages;     if (languages == null || languages.Length == 0 )     return nul