Compartir a través de


Programming Languages in ASP.NET

An ASP.NET page is restricted to code written in a single programming language. Currently, ASP.NET supports Visual Basic, C#, and J#. The default language is Visual Basic, but any other language can be declared as the default language for the page by placing a directive at the top of the page, such as the following:

<%@Page Language="C#"%>

The language can also be declared in a <script language = …> block, as in the example provided in Code Blocks in ASP.NET. If different languages are declared in separate script blocks on the same page, an error will be raised.

Although only one language can be used on a single page, any user controls that you use on a page can be written in different languages, including Visual C++. This allows applications to take advantage of function libraries in different languages.

Visual Basic Scripting Edition (VBScript) is not supported, but VBScript syntax is very similar to Visual Basic 2005 syntax, so any required changes to existing code should be minor.

See Also

Other Resources

Common Language Runtime
Cross-Language Interoperability
Migrating to ASP.NET