Active server pages at dot net platform are used to create enriched web applications.
ASP.NET, the next version of ASP, is a programming framework that is used to create enterprise-class Web applications. The enterprise-class Web applications are accessible on a global basis, leading to efficient information management. However, the advantages that ASP.NET offers make it more than just the next version of ASP.
ASP.NET is integrated with Visual Studio .NET, which provides a GUI designer, a rich toolbox, and a fully integrated debugger. This allows the development of applications in a What You See is What You Get (WYSIWYG) manner. Therefore, creating ASP.NET applications is much simpler.
Unlike the ASP runtime, ASP.NET uses the Common Language Runtime (CLR) provided by the .NET Framework. The CLR is the .NET runtime, which manages the execution of code. The CLR allows the objects, which are created in different languages, to interact with each other and hence removes the language barrier. CLR thus makes Web application development more efficient.
In addition to simplifying the designing of Web applications, the .NET CLR offers many advantages. Some of these advantages are listed as follows.
The ASP.NET code is a compiled CLR code instead of an interpreted code. The CLR provides just-in-time compilation, native optimization, and caching. Here, it is important to note that compilation is a two-stage process in the .NET Framework. First, the code is compiled into
the Microsoft Intermediate Language (MSIL).
Then, at the execution time, the MSIL is compiled into native code. Only the portions of the code that are actually needed will be compiled into native code. This is called Just In Time compilation. These features lead to an overall improved performance of ASP.NET applications.
The entire .NET class library can be accessed by ASP.NET applications. You can use the language that best applies to the type of functionality you want to implement, because ASP.NET is language independent.
The application-level configuration settings are stored in an Extensible Markup Language (XML) format. The XML format is a hierarchical text format, which is easy to read and write. This format makes it easy to apply new settings to applications without the aid of any local administration tools.
ASP.NET applications are secure and use a set of default authorization and authentication schemes. However, you can modify these schemes according to the security needs of an application.
In addition to this list of advantages, the ASP.NET framework makes it easy to migrate from ASP applications.
In the next post we are going to learn how do we start a asp.net application.
Creating an ASP.NET Application can be done in different ways as explained below.
Use a text editor:
In this method, you can write the code in a text editor, such as Notepad, and save the code as an ASPX file. You can save the ASPX file in the directory C:\inetpub\wwwroot. Then, to display the output of the Web page in Internet Explorer, you simply need to type http://localhost/.aspx in the Address box.
If the IIS server is installed on some other machine on the network, replace "localhost" with the name of the server. If you save the file in some other directory, you need to add the file to a virtual directory in the Default WebSite directory on the IIS server. You can also create your own virtual directory and add the file to it.
Use the VS.NET IDE for creating asp.net application:
In this method, you use the IDE of Visual Studio .NET to create a Web page in a WYSIWYG manner. Also, when you create a Web application, the application is automatically created on a Web server (IIS server). You do not need to create a separate virtual directory on the IIS server.
ASP.NET Web pages consist of HTML text and the code. The HTML text and the code can be separated in two different files. You can write the code in Visual Basic or C# . This separate file is called the code behind file. In this section, you'll create simple Web pages by using VB as well as C#.
Before you start creating a Web page, you should be familiar with basic ASP.NET syntax. At the top of the page, you must specify an @ Page directive to define pagespecific attributes, such as language. The syntax is given as follows:
<%@ Page attribute = value %>
To specify the language as VB for any code output to be rendered on the page, use the following line of code:
<%@ Page Language = "VB" %>
This line indicates that any code in the block, <% %>, on the page is compiled by using VB.
To render the output on your page, you can use the Response.Write() method.
Creating a Visual Basic Web Application
You can create an ASP.NET application using Visual Basic by creating a Visual Basic
Web Application project. To do so, complete the following steps:
1. Select File ® New ® Project. The New Project dialog box appears.
2. Select Visual Basic Projects from the Project Types pane.
3. Select ASP.NET Web Application from the Templates pane. The Name box contains a default name of the application. The Location box contains the name of a Web server where the application will be created. However, you can change the default name and location. In this case, the name of the sample application is SampleVB.
Deploying an ASP.NET Web Application
After creating and testing your ASP.NET Web applications, the next step is deployment.
Deployment is the process of distributing the finished applications (without the source code) to be installed on other computers.
In Visual Studio .NET, the deployment mechanism is the same irrespective of the programming language and tools used to create applications. Here, you'll deploy the application created by using VB. To do so, follow these steps:
1. Open the Web application project that you want to deploy. In this case, open the SampleVB project.
2. Select File ® Add Project ® New Project to open the Add New Project dialog box.
3. From the Project Types pane, select Setup and Deployment Projects.
From the Templates pane, select Web Setup Project.
4. Change the default name of the project. In this case, change it to "SampleVBDeploy."
5. Click OK to complete the process. The project is added in the Solution Explorer window.