This documentation is archived and is not being maintained.

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 JScript. 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:


The language can also be declared in a <script language = ...> block, as in the example provided in the Code Blocks topic. If different languages are declared in separate script blocks on the same page, an error will be thrown. 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. This allows applications to take advantage of function libraries in different languages (accomplished by the use of #include files in ASP today).

Visual Basic Scripting Edition (VBScript) is no longer supported, but VBScript syntax is very similar to Visual Basic .NET syntax, so any required changes to existing code should be minor. For an example of converting VBScript code to Visual Basic .NET, see the example in Visual Basic Language Changes.

ASP.NET supports all the Common Language Specification (CLS)-compatible programming languages supported by the common language runtime, including Visual Basic and C#.

See Also

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