Urgent - Adding a C# web page to a VB web solution ---- NOT F@#KING LIKELY!

  • Thread starter Thread starter John
  • Start date Start date
J

John

Hi all,

I really need help on this one. In some obscure documentation I remember MS
stating that it's possible to have a web solution with both vb AND c# web
pages. If that be the case, how do I add them in such a way that Visual
Studio allows proper interaction between the two?

What I mean is that when I add a c# web page to the solution, everything is
fine until I close the designer page down. When I double click on the c#
page from the Solution Explorer, I receive an error message "The file could
not be loaded into the web forms designer blah, blah . . .

How do I work around this?

Regards
John.
 
Hi,

I think that you could do so, it may get a pain to maintain but it may be
possible.
I have never try it though, so I'm talking in theory.

What may be happening is that the IDE try to format both the code behind as
well as the aspx page to the template you are using, therefore when he try
to access the code behind page it does not understand the C# file, as he is
expecting a VB kind of file.

Even so I don't know if you can use code behind in such an environment.

Probably you will be able to load the aspx page in HTML mode, not in design
mode.

My advice, is to rewrite the page in VB, in the long run is the best
approach.

cheers,
 
I've never tried this in ASP.NET but I assume it's the same as with any
solution -- VB and C# code must be segregated into separate projects within
the solution. Although it may be possible to mix them within the same
project based on the lang directive at the top of each page, I imagine that
the IDE really doesn't contemplate the server side language being different
within a single project.

--Bob
 
I don't think that you're going to be able to combine them in the same
project. C# is compiled with the C# compiler and VB is compiled with the VB
compiler. Having separate languages in their own project but within the
same solution is possible.

DalePres
 
I have mixed languages within an ASP.NET application and VS solution,
but VS projects are single-language. If we set VS to the side for a
minute, the runtime will properly JIT compile the page using the
language in the @Page directive, and you can mix pages and user
controls of different languages in the same web site. This works fine.
Now, let's talk about the IDE. You can also have a web project for C#
and reference another project in VB within the same solution. Within
each project, however, you are restricted to a single language.
Classes in projects are compiled together, and the project settings
determine the compiler used.

Best regards,
Jeffrey Palermo
Blog: http://www.jeffreypalermo.com
 
Back
Top