Archive for May, 2007

Why Precompile???

The advantages of precompiling a web application is that
1. It ensures faster page-load and
2. provides more security to the code.
Here are few articles which will help in understanding precompilation better and also how to precompile an ASP.NET2.0 web application…
msdn link
quote – “The primary disadvantages of deployment pre-compilation are that you have to perform these steps prior to deployment and that you can’t change your Website after it has been deployed. If you want to make changes, you have to recompile the Website and redeploy it”
(How to precompile)
Also chk out this article by Rick Starhl titled – “Watch out with precompiled ASP.NET 2.0 Applications if you have Orcas installed

May 28, 2007 at 7:39 am 2 comments

Invalid cast from ‘System.String’ to ‘System.TimeSpan….

I have already mentioned in one of my previous blog articles, I am working on a web application which has been converted from 1.1 to 2.0. And because of the many minor changes made in the 2.0 framework, I keep encountering many exceptions!!!

One such exception was raised while making use of Convert.ChangeType method.

When i tried to convert a string to timespan an InvalidCastException was raised. Reason??? In this framework, the method does not support this type of a conversion….

There is the option of using Parse method or TryParse method in TimeSpan class… (TryParse is a newly added method which is very much similar to the Parse method but this doesn’t throw an exception when the conversion fails).

Another thing to keep in mind while using this method is that it doesn’t handle nullables.

May 19, 2007 at 3:46 am 1 comment

Localization (a brief introduction)

Presently, with the increase in the number of non-english users, internationalizing web sites has become quite important. In this article, as the title suggests… I am going to very brief explaination about how a web site can be localized.

To begin with, for localizing a web application a programmer needs to –

1. identify the localizable entities of the application. These can be any one of the following- Text Resource; Graphics; Database content; Dates; and maybe currencies, etc.,

2. is to identify which method of retrieval of culture information. And for this one can make use of the web.config or the page directive or allow the user to select the culture through the application itself


3. is to identify how the resource information has to be stored. This can be done by using 1. the Database or 2. the Resource files (.resx files); 3. the Text files (which can be easily converted into a Resource file) or 4. an xml file or 5. an excel sheet.

all this will obviously be based on whatever is suitable for your app.

I created this very simple web application in which i allow the user to either select English(US) or Deutsche (Germany) language and am making use of .resx files to store the resources.

To be more specific, I am going to make use of two pages, SelectLang page and LangIndicator page. The SelectLang page will contain a dropdownlist from which the user can select the required language and the LangIndicator page is going to make use of this selected information to set the current thread culture. And thats it….


May 6, 2007 at 2:42 pm 1 comment

May 2007
« Apr   Jun »