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. In this section, you'll deploy the "Hello World" Web application that you created. You can deploy any of the application that was created by using VB or C#. 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. Also, a File System editor window appears to the left, as shown in Figure 2-7. The editor window has two panes. The left pane displays different items. The right pane displays the content of the item selected in the left pane.
Figure 2-7: The Deployment editor
6. Select Web Application Folder in the left pane of the File System editor window. Then, from the Action menu, select Add → Project Output to open the Add Project Output Group dialog box, shown in Figure 2-8.
Figure 2-8: The Add Project Output Group dialog box
7. Verify that SampleVB is selected in the Project drop-down list. Then, select Primary Output and Content Files from the list.
8. Click OK. The output files and content files of the SampleVB project are added to the solution.
9. Select Web Application Folder in the File System editor and select Properties Window from the View menu to open the Properties window. 10. Set the VirtualDirectory property to a folder, <folder name>, that
would be the virtual directory on the target computer where you want to install the application. By default, this property is set to
SampleVBDeploy, which is the name of the Web Setup project that you added. In this case, set the property to DeployedApplication.
Caution The <folder name> should be a new folder name and should not already exist on the target machine. Otherwise, the contents in the folder will be overwritten.
11. In the same Properties window of the Web Application Folder, set the
DefaultDocument property to WebForm1.aspx. This property is used to set the default Web Forms page for the application.
12. Build the solution by selecting Build Solution from the Build menu. 13. After the solution is built successfully, a SampleVBDeploy.msi file is
created in the Debug directory of the Web Setup project. The default path is \documents and settings\<login name>\My Documents\Visual Studio
Projects\SampleVB\SampleVBDeploy\Debug\SampleVBDeploy.msi. 14. Copy the SampleVBDeploy.msi file to the Web server computer
(c:\inetpub\ wwwroot) where you want to deploy the application.
15. Double-click the SampleVBDeploy.msi file on the target computer to run the installer.
Note To run the installer, you must have the install permissions on the computer. And, to install to the Web server, you must have IIS permissions.
After the installation is complete, you can run your application on the target computer. To do so, start Internet Explorer and enter http://<computer
name>/DeployedApplication in the address box. The "Hello World" page that you developed is displayed.
Summary
In this chapter, you learned how to set up the development environment for creating ASP.NET applications. Then, you learned how to create a simple ASP.NET application by using both VB and C#. Finally, you learned how to deploy an application on a Web server.
Chapter 3:
Building Forms with Web Controls
Overview
The increased use of the Internet in the business scenario has shifted focus from desktop applications to Web-based applications. Because of this shift in focus, a Web development technology is needed that can combine the capabilities of different
languages and simplify application development. Microsoft's response to this need is the release of ASP.NET, which provides a common Web development platform.
ASP.NET is a powerful programming platform that is used to develop and run Web- based applications and services. ASP.NET provides improved features, such as convenient debugging tools, over the earlier Web development technologies. ASP.NET provides a rich set of controls to design Web pages. Visual Studio .NET provides visual WYSIWYG (What You See Is What You Get) HTML editors. Therefore, you can design Web pages by simply dragging and dropping the controls. ASP.NET supports the C#, Visual Basic .NET, and JScript .NET languages, all of which you can use to build programming logic for your Web pages. You can choose which one of these languages to use based on your proficiency on a particular language. One of the most important features of ASP.NET is that it provides separate files for page presentation and programming logic, which simplifies Web application development. This chapter introduces you to designing simple Web pages by using basic Web controls. You'll also learn how to handle various events of these controls.