3

I have an old VB.NET site and looking to add new pages to it. I'm not a VB man so is it possible to create new pages in the site but using C#? I've never done this before and never seen it done so I'm guessing no.

Cheers

Funky
  • 12,890
  • 35
  • 106
  • 161

3 Answers3

4

Yes you can if you have a website project - have a look at this question (and answer): Is it possible to have C# and vb.net in the same asp.net website?

basically you do this in the config file

<configuration>
    <system.web>
        <compilation>
            <codeSubDirectories>
                <add directoryName="VB_Code"/>
                <add directoryName="CS_Code"/>
            </codeSubDirectories>
        </compilation>
    </system.web>
</configuration>

Then create folders of the same name in the App_Code folder

More info on this here: http://pietschsoft.com/post/2006/03/30/ASPNET-20-Use-VBNET-and-C-within-the-App_Code-folder

Community
  • 1
  • 1
Matt Wilko
  • 26,994
  • 10
  • 93
  • 143
0

No, you can't. Here is the answer: https://stackoverflow.com/a/1278052/2999249

No, you can't. An assembly/project (each project compiles to 1 assembly usually) has to be one language. However, you can use multiple assemblies, and each can be coded in a different language because they are all compiled to MSIL.

Community
  • 1
  • 1
Andrii Tsok
  • 1,386
  • 1
  • 13
  • 26
0

You cannot mix VB.NET and C# or other language in the same assembly (project). But... you can have different projects (languages) in your solution.

CodeTherapist
  • 2,776
  • 14
  • 24