Translate ASPX page from VB.NET to C#

  • Thread starter Thread starter GMartin
  • Start date Start date
G

GMartin

Are there any significant stopping blocks from taking an ASPX Page
someone designs in VB.NET, and redoing the Code behind page to use C#?

Is the Code behind the only thing one would need to change? ...That
and the Page Language="vb" in the HTML? (Are there differences to the
way each lays out the HTML?)

I wouldn't mind some utilities, but would also like to know what's
involved in doing it manually.
 
I don't know of any utilities, but the HTML and <aspx:Control> markup
should not have to change at all. One area you might have to watch for
is if anyone put VB code inline with the ASPX using <% %> blocks, or
used language specific data binding expressions (DataBinder.Eval will
work with either language).
 
The page language is the language used for the actual aspx page, not the code
behind file. It's possible to have your aspx pages in C# while your code
behind files are VB (and vice versa).

Our Instant C# converter can do this for you.
Download the Demo Edition at www.instantcsharp.com

David Anton
www.tangiblesoftwaresolutions.com
Home of the Instant C# VB.NET to C# converter
and the Instant VB C# to VB.NET converter
 
Just convert your classes/Codebehind to C# or vice versa
Your HTMl will work in both scenario
 
Hi, David.

Do you mean that it's possible to do this :

<%@ Page language="c#" Codebehind="SimplePage.aspx.vb"
AutoEventWireup="false" Inherits="SimplePage" %>

Why would you want to do that ?
And, does it really work ? ( I've never tried it. )

In Whidbey, won't the new partial class syntax eliminate that possibility ?

<%@ Page Language="C#" CompileWith="test-difflangCS.aspx.cs"
ClassName="test_difflangCS_aspx" %>

Notice that both CompileWith and classname incorporate the page's name.
That should preclude what you're saying can be done now.




Juan T. Llibre
ASP.NET MVP
http://asp.net.do/foros/
Foros de ASP.NET en Español
Ven, y hablemos de ASP.NET...
======================
 

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

Back
Top