创建一个 ASP.NET WEB 应用程序
资料介绍:
ASP.NET是一项功能强大、动态Web页面。通过它可以很容易的创建动态的Web页。它是利用.NET Framework提供的新功能来创建动态Web页面的一种方法。ASP.NET不仅可以生成动态Web页面,并可以将这些页面根据正在使用的浏览器进行裁剪,而且,它提供了大量的、可复用的预定义控件,用于asp.NET项目,减少了要编写的代码,从而在编程时提高工作效率。
既然您得知一些了Visual Studio .NET的特点, 下步将利用他们帮助您应用。 很使用起来是很方便的,在这本章节里您将很精确地学习到怎么的使用它。
开始您将使用.NET中的两个主要项目类型,然后,您将学到如何在.NET中使用文件类型。其次,您将学会怎么创建一个新的WEB应用程序, 增加一个新的WEB页, 并且增加控键来控制和操作他们的属性。最后, 您将学会怎么增加代码、建立项目、并且如何测试。
一、asp.NET的项目类型
有三个基本的ASP.NET应用程序类型, 每个都有其各自的用途。ASP.NET的WEB应用程序将为它自己提供基于HTML的用户界面。ASP.NET的WEB 服务具有存取应用程序的功能。Visual Studio .NET 2003的新的应用是,asp.NET的动态WEB网页的应用, 他们设计的重点瞄向了个人数字助理机(PDAs), 手机, 和其它数字化设备。虽然Visual Studio .NET的环境使开发应用程序显着更加容易和快速,但您仍可以不使用Visual Studio .NET来开发他们。
[资料来源:http://Doc163.com]
以下例证显示模板为Visual Basic 的 Visual Studio .NET的新建项目对话框,显示有ASP.NET的WEB应用程序、ASP.NET的WEB服务和asp.NET的数字化应用项目。 (一些项目模板被显示了但并不是所有的都出现在了Visual Studio .NET编辑器上)。
二、asp.NET 的WEB应用程序
ASP.NET 的WEB应用程序, 在他们最简单, 是很象经典ASP 的应用程序。 简单asp.NET 的要素有
◆ 在IIS中有一个虚拟目录,它被作为根目录来配置,它包含文件且控制对文件的存取。
◆ 一个或更多的.aspx 文件。
◆ 一个全球化的.aspx 文件(类似于经典asp中的全球化的.asa文件),它可以让会话和应用程序启动和情理逻辑,这个文件是可选的。
◆ 一个Web.config文件经常用来存储配置设置。这个文件也是可选的,并且是asp.NET 的一个新文件。
Creating an asp.NET Web Application
ASP.NET is a technology for building powerful, dynamic Web pages. ASP.NET makes building real world Web applications dramatically easier. It is a way of creating dynamic Web pages while making use of the innovations present in the .NET Framework. It also comes with a great set of reusable, predefined, and ready to use controls for your asp.NET projects. These reduce the amount of code you have to write, so you can be more productive while programming. [资料来源:https://www.doc163.com]
Now that you've learned about some of the features of Visual Studio .NET, the next step is to take advantage of them in your own applications. Conveniently enough, that's precisely what you're going to learn how to do in this chapter..
You'll begin with an overview of the two major project types used for ASP.NET applications. Then you'll look at the file types used in asp.NET and the purpose of each. Next, you'll learn how to create a new Web application, add a new Web Forms page, and add controls to the page and manipulate their properties. Finally, you'll learn how to add event-handler code to the page, build the project, and test the page。
I、asp.NET Project Types
There are three basic types of ASP.NET applications, each with a distinct purpose. ASP.NET Web Applications are for a Web application that will provide its own HTML-based user interface. ASP.NET Web Services are for Web-based functionality that will be accessed programmatically. ASP.NET Mobile Web Applications, new in Visual Studio .NET 2003, are designed for creating Webapplications targeted at Personal Digital Assistants (PDAs), cell phones, and other mobile devices. You can develop all of these application types with or without Visual Studio .NET, although the Visual Studio environment makes developing them significantly easier and faster. The following illustration shows the Visual Studio .NET New Project dialog box displaying the ASP.NET Web Application, ASP.NET Web Service, and asp.NET Mobile Web Application project templates for Visual Basic .NET (some of the project templates shown might not appear in all editions of Visual Studio .NET)。
[资料来源:www.doc163.com]
II、asp.NET Web Applications
ASP.NET applications, at their simplest, are much like classic ASP applications. The elements of a simple asp.NET application are
◆ A virtual directory in IIS, configured as an application root, to hold the files that make up the application and to control access to the files.
◆ One or more .aspx files.
◆ A Global.asax file (analogous to the Global.asa file in classic asp) to deal with Session and Application startup and clean-up logic. This file is optional.
◆ A Web.config file used to store configuration settings. This file is optional, and is new for asp.NET.
For Visual Studio .NET users, the good news is that all of the preceding files are created for you when you create a new Web application project.
III、asp.NET Web Forms