Saturday, August 25, 2007

Use vb & C# classes in same application (web app)

Use vb & C# classes in same application (web app)

In our application we mainly use only one type of class files say Vb or C#. what if we want to use two or more different language files in one web app ?

in app_code create two folders , let say vb & cs, and place the corresponding class files into it

add this piece of code to your web.config

<compilation debug="true" strict="false" explicit="true">
<codeSubDirectories> <add directoryName="vb"/>
add directoryName="cs"/>

you can use any folder name instead of VB or CS, the .Net compiler will look into each folder and try to compile all the class files found. But if it finds more than one different language files it throws an exception. the above piece of code will direct the compiler to check additional folders in App_code for class files for compilation.

No comments: