July 2009 - Posts

ASP.NET MVC 2 Preview 1 is released!

 

ASP.NET MVC 2 first preview is released to public now and you can download it from Microsoft download site. Here is short overview of technical requirements and main new features of ASP.NET MVC 2 Preview 1.

System requirements
  • Windows 7, Windows Vista, Windows Server 2003 or Windows Server 2008,
  • .Net Framework SP 1,
  • Visual Studio 2008, Visual Studio 2008 SP1, or Visual Web Developers 2008 SP1
New features
  • areas support – allows to group and partition functionality in large ASP.NET MVC applications,
  • DataAnnotation validation support – ASP.NET MVC 2 is able to use same data annotation mechanism as ASP.NET Dynamic Data and .NET RIA Services do,
  • strongly typed UI helpers – let you use strong-typed lambda expressions when referencing the view template’s model object,
  • UI Helper templating support – new methods to bind custom editors and displays to model properties,
  • other cool features – find out by yourself :)

References:

 

Thanks Gunnar Peipman .. its just a quick copy and paste

Hope that helps

Posted by Huthaifa Afanah | with no comments
Filed under:

ASP.NET Globalization hint

As one of the most powerful features came with the ASP.NET 2.0 is the out of the box globalization and localization features. Today websites and web applications is usually became a multilingual ones and ASP.NET provides us with a flexible, easy to use and time saving  localization mechanism. I ran into a silly issue about localizing a project I am working with and after losing my mind and finished tearing up my hair I said “opps .. I missed something .. the fallback file”

Ok .. to localize your application you need to make use resources files which ends with the *.resx extension local resources or global resource there is no difference. Anyway in the most simple case if you have a Default.aspx form to localize it you must have a related .resx files. One file per culture using this naming convention Default.aspx.[culture].resx … So if you you application supports 3 languages say: English, Arabic, French you must have one resource file for each language. This means we need to have:

  • Default.aspx.en-US.resx for the English page with USA specifications
  • Default.aspx.ar-SA.resx for the Arabic page with Saudi Arabia specifications
  • Default.aspx.fr-CA.resx for the French page with Canada specifications

You may use neutral cultures which related to language rather than a specific region culture e.g en, ar and fr … anyway after doing this you think you are fine but when you run the application you will discover that your pages does not read any values form those files and you still have those you filled when developing the form.

This occurs because in all circumstances you need to provide a default resource file which called “Fallback” resource file –will look like this Default.aspx.resx- which CLR will use when the users culture does not have its own resources file. e.g say that we have a visitor with the Chinese culture on his browser then the fallback resources will be used to get the required resources to serve his request.

What make me forget about the fallback resources file in my case is the truth that I am forcing users to choose between en-US and ar-SA –which is the default- culture. I thought: who need this file while the users will have a default culture and can only switch to another predefined one. Plus the resource mechanism works by searching for the users specific culture first –which in my case is forced by code to use ar-SA - in the cultures hierarchy and then move to the parent culture and so on!!

Hint

You need to make sure that you ever never forget about providing Default or Fallback resource file in your application. I will make another detailed post about how CLR handle resources. Hope that helps