A blog of ASP.NET 2.0 Samples, Articles, Reviews and Discussions. The purpose of this blog is to provide a resource to the quick information that developers need on Microsoft's new ASP.NET 2.0.

Tuesday, December 13, 2005

Supporting different languages in a site ASP.NET 2.0

This is a cool topic that I came across. ASP.NET 2.0 supports multiple languages in one project just by adding a few lines of code. What are those lines of code you might ask? Wait! Hold your horses. For starters, it has to do with your \Code directory. By default, your \Code directory only supports one language. However, if you inform your web.config of different code directories, then voila.


within your web.config add :


<system.web>
<compilation>
<codesubdirectories>
<add directoryname="Code.CSharp">
<add directoryname="Code.VB">
<codesubdirectories>
<system.web>



which means :

D:\Corp\Intranet\App_Code\Code.VB\CoolVBCode.vb
D:\Corp\Intranet\App_Code\Code.Csharp\CoolCSCode.cs

are valid.

You can then act as you normally do with your pages. Note that only one lang is supported within each directory. Sorry no vb files in the C# directory. Hey what more could you want?

0 Comments:

Post a Comment

<< Home