Any reason one page's code behind shouldn't be vb an another C#

A

AAaron123

I was advised once not to mix C# and VB in the same project (I think
"project" was the word used. Maybe it was "solution").

So I added two projects to my solution - a vb library and a c# library.

I've since learned that there is a "Web Site" and a "Web Application
Project" configuration and wonder if the advice applies to a "Web Site".

So the question is: For a Web Site, is there any reason one page's code
behind shouldn't be vb an another C#.

As far as I can tell it works OK since I had it that way once without an
apparent problem.

Thanks
 
S

Stan

I was advised once not to mix C# and VB in the same project (I think
"project" was the word used. Maybe it was "solution").

So I added two projects to my solution - a vb library and a c# library.

I've since learned that there is a "Web Site" and a "Web Application
Project" configuration and wonder if the advice applies to a "Web Site".

So the question is: For a Web Site, is there any reason one page's code
behind shouldn't be vb an another C#.

As far as I can tell it works OK since I had it that way once without an
apparent problem.

Thanks

ASP.NET will tolerate mixed languages between pages and even between
master and content pages. It will not allow mixed languages though for
class files in the App_Code directory. The criteria is the compilation
process. Where source files have to be compiled together they must be
a single language, but when they are compiled as separate modules then
it doesn't matter because they all translate to the same intermediate
form (MIL).
 
J

Juan T. Llibre

re:
!> It will not allow mixed languages though for class files in the App_Code directory

That is totally untrue.

You can add subdirectories to the App_Code directory
in order to process multiple languages under the App_Code directory.

In order to do this, you need to register each subdirectory in the application's Web.config.

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

Then, simply creating the App_Code\VB and App_Code\CS directories,
and placing your VB and CS files in each, will allow you to use both languages in your app.

This only works in ASP.NET 2.0 or later.




===============
 
A

AAaron123

AAaron123 said:
I was advised once not to mix C# and VB in the same project (I think
"project" was the word used. Maybe it was "solution").

So I added two projects to my solution - a vb library and a c#
library.

I've since learned that there is a "Web Site" and a "Web Application
Project" configuration and wonder if the advice applies to a "Web
Site".

So the question is: For a Web Site, is there any reason one page's
code behind shouldn't be vb an another C#.

As far as I can tell it works OK since I had it that way once without
an apparent problem.

Thanks

Four great replies so quick.

Thanks
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,012
Latest member
RoxanneDzm

Latest Threads

Top