locked
two classes in different languages in \App_code folder RRS feed

  • Question

  • Hi,

       I am new to .net language, now only started learning asp.net, in the chapter about \App_Code folder it was shown that two classes were added one written in vb and another written in csharp with .cs extension, is it possible to have two classes with two different languages can anybody please clarify my doubt?

    Karthik

    Sunday, September 18, 2011 9:39 AM

Answers

  • karthikpk,

    In a website project, yes you can do that.  There are two things you need to do to make this work.

    1.  In the App_Code directory, create separate directories for each language.  For example create a \App_Code\VB folder and a  \App_Code\CS folder.

    2.  In your Web.Config, add the following to your <compilation> section:

    <system.web>
          <compilation debug="false" targetFramework="4.0">
              <codeSubDirectories>
                  <add directoryName="CS"/>
                  <add directoryName="VB"/>
              </codeSubDirectories>
          </compilation>
    

    Now, the website will compile classes written in either language and you can use them.

     


    Tom Overton
    Sunday, September 18, 2011 1:04 PM
  • For ASP.NET questions, please use http://forums.asp.net/.

    Thanks,
    -Karel

    Thursday, September 22, 2011 1:11 AM

All replies

  • karthikpk,

    In a website project, yes you can do that.  There are two things you need to do to make this work.

    1.  In the App_Code directory, create separate directories for each language.  For example create a \App_Code\VB folder and a  \App_Code\CS folder.

    2.  In your Web.Config, add the following to your <compilation> section:

    <system.web>
          <compilation debug="false" targetFramework="4.0">
              <codeSubDirectories>
                  <add directoryName="CS"/>
                  <add directoryName="VB"/>
              </codeSubDirectories>
          </compilation>
    

    Now, the website will compile classes written in either language and you can use them.

     


    Tom Overton
    Sunday, September 18, 2011 1:04 PM
  • For ASP.NET questions, please use http://forums.asp.net/.

    Thanks,
    -Karel

    Thursday, September 22, 2011 1:11 AM