版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1、毕业设计 (论文 )外文资料翻译题目:ASP.NET 概述院系名称:信息科学与工程学院专业班级:计算机科学与技术05 级6 班学生姓名:学号:指导教师:教师职称:起止时间:地点附件:1.外文资料翻译译文;2.外文原文。指导教师评语:外文资料的选择与毕业设计内容密切相关,文章具有一定的难度,但译文能够较好的表达出原文的思想。专业术语运用比较准确,语句通顺,文字数量符合要求。不足之处在于个别语句的翻译缺乏润色,有些牵强。总之,译文符合要求,反映出学生具有较好的专业外文阅读和翻译能力。签名:2009年3月2日ASP.NET 概述当 ASP 第一次发布时, Web 编程还比较困难,因为需要 IIS 来
2、处理 ASP 页。后来,ASP.NET2.0 和 Visual Studio?2005 通过引入网站开发模型使一切工作都变得容易了。借助该网站模型,您不必在Visual Studio 中创建新项目,而是可以指向一个目录并开始编写网页和代码。此外,您还可以使用内置的ASP.NET Development Server快速测试站点, ASP.NET Development Server将 ASP.NET 寄宿在一个本地进程中,并消除了必须安装 IIS 才能进行开发这一先决条件。下面从不同的方面来介绍A2.0 技术。类库ASP.NET是微软 .NET framework 整体的一部分 ,它包含一组大
3、量编程用的类,满足各种编程需要。因为 Visual Basic、JScript和 C+这些编程语言的很多功能具有重叠性。举例来说,对于每一种语言,你必须包括存取文件系统、与数据库协同工作和操作字符串的方法。 此外,这些语言包含相似的编程构造。 都能够使用循环语句和条件语句。即使用 Visual Basic写的条件语句的语法和用 C+的不一样 ,程序的功能也是相同的。对于多种语言来说维持这一功能需要很大的工作量。那么对所有的语言创建这种功能一次,然后把这个功能用在每一种语言中岂不是更容易。然而 .NET类库不完全是那样。它含有大量的满足编程需要的类。举例来说, .NET类库不仅包含处理数据库访问
4、的类和文件协同工作,操作文本和生成图像,而且还包含更多特殊的类用在正则表达式和处理 Web协议。此外 .NET framework ,也包含支持所有的基本变量数据类型的类,比如:字符串、整型、字节型、字符型和数组。.NET framework 是庞大的。它包含数以千计的类。 (超过 3,400)幸运地是,类不是简单的堆在一起。 .NET framework的类被组织成有层次结构的命名空间。一个命名空间包含一组逻辑的类。举例来说,涉及到与文件系统协同工作的类就集合在 System.IO命名空间中。命名空间被组织成一个层次结构(一棵逻辑树 )。树根就是SYSTEM 命名空间。这个命名空间包含基本的
5、数据类型的所有的类,例如:字符串、数组,还包含提供随机数字和日期的类。你通过完整的类的命名空间能唯一识别任何的类在.NET framework 中的位置。例如,指定找到一个 the File class类,按如下操作 :System.IO.文件System.IO指命名空间,而文件指定特定的类。在默认情况下,在你的 ASP.NET页面中,类被包含在一个选定的命名空间中这些默认的命名空间使你在 ASP.NET中最常用到的。.Net支持 C#,JScript.NET,C+ 和Visual Basic中的任一种语言作为你的编程语言来完成 ASP.NET 程序编写。但不管你使用什么语言开发 ASP.NE
6、T 页面,你需要明白 ASP.NET 在执行前必须编译,这就意味着 ASP.NET 执行速度非常快。第一次请求 ASP.NET 页面 ,页面被编译成一个 .NET 类,这个类文件被保存在一个特殊的目录下,这个目录的名字叫TemporaryASP.NET Files。对于一个 ASP.NET 页面一个通信类文件也会出现在Temporary ASP.NET Files目录下。以后不管任何时候你请求那个同样的ASP.NET 页面,那个通信类文件就会执行。当ASP.NET 页面被编译的时候,它没被直接地被编译成机器码而是被编译成了一个中间语言,名字叫MSIL ,所有 .NET 可用的语言都被编译成这种
7、中间语言。一个ASP.NET页面不会被编译成本地机器码直到它被一个浏览器访问,在那个时间点包含在 Temporary ASP.NET Files目录下的类文件用 JIT 编译器编译并且执行。这些迷惑的方面体现在整个过程中且都在后台运行,你必须要做的是用资源代码为你的 ASP.NET 页面创建一个文本文件。2.用Web服务器控件创建窗体用几个基本 Web控件来代替标准的 HTML 窗体元素,例如 radiobuttons、textboxes,and listboxes.在 Web应用程序中可以用这些控件创建用户界面。3.用验证控件做页面验证传统地,当增加验证到页面中时,会面临一个严峻的选择。你可
8、以添加窗体页面验证规则到你的服务器端代码,也可以添加验证规则到你的客户端代码。写验证代码到客户端代码中的优势能够及时反馈到你的用户。例如,一个使用者忽略输入一个要求检验的字段, 你能够及时的显示一个错误信息而不需要返回到服务器端解决。 人们喜欢客户端的验证。 它能产生一种很好的效果。然而,问题是它不与所有的浏览器兼容。不是所有的浏览器支持JavaScript、不同版本的浏览器的不同版本支持 JavaScript,所以客户端验证没有保障。 由于这个原因, 许多开发者决定添加自定义验证到服务器端。因为服务器端代码能够和任何浏览器协同工作。 这样的做法是更有安全保障。同时这些验证控件会自动地产生客户
9、端代码和服务器端代码。 如果一个浏览器有能力支持 JavaScript,客户端的验证脚本将会自动返回到浏览器。如果一个浏览器不支持 JavaScript,那个验证规则会自动在服务器端代码中执行。控制字段 :RequiredFieldValidator 控件你可以用这个控件来检查在一个 Web窗体中是否为空,典型地,你和TextBox控件一起使用这个控件。然而,这个控件也可以和其 他的输入型控件结合使用,例如: RadioButtonList 控件。验证表达式 :RegularExpressionValidator控件你能使用 RegularExpressionValidator控件来验证输入的
10、值是否和定义的正则表达式相匹配。 例如:你能使用这控件来检查一个用户是否输入一个合法的电子邮件地址,电话号码,用户名或密码。比较值 :CompareValidator控件这个 CompareValidator 控件用于比较一个输入的数据和另外一个值是否相同。另外一个值可能是固定值,例如:一个特定的数字或者是输入到另一个控件中的一个值。总结错误 :ValidationSummary控件假想一个页面有 50个字段假如你仅仅用上部分讨论的那些验证控件来显示错误看见一个错误在页面中将是很难的。例如:你可能需要滚动到第 48个页面字段来找到这个错误信息。幸好,微软除了包含上面提到的控件还包括 Valid
11、ationSummary控件。你能用这个控件综合所有的错误信息在一个页面的上端或者你想要的任何一个地方。4.先进的控件编程保存浏览状态默认地,几乎所有的 ASP.NET 控件都会在先前的窗体中保留他们的属性值。举例来说,如果你输入文本到一个 Lebel标签上然后提交那个页面,当那个页面再次被访问时那个 Lebel标签的内容将会被保存下来。 浏览状态的妙处是它不依赖任何的特定服务器或浏览器的属性。尤其,它不依赖 cookies,session变量、或应用程序变量。浏览状态在一个名叫做 VIEWSTATE 的隐藏页面中执行,这个隐藏页面自动创建每个 Web窗体。当应用时 ,浏览状态能够在你的网站中
12、产生艺术性的积极效果,例如:你在一个支持浏览状态的控件中显示数据库数据,你不需要每次都返回到需要反馈到服务器的数据库页面。它能够自动地保存页面里的数据状态。使用 Visible and Enabled属性每个控件 ,包括 HTML 和Web控件 ,有一个 Visible 属性来决定那个控件是否可见。一个控件的 Visible 是false值,那个控件就不会在页面上显示;那个控件也不会进一步运行。当Web控件 (不是每个 HTML 控件 )还有一个叫 Enabled的属性。当 Enabled的属性是 false 值,你用的浏览器是 IE4.0或更高的版本那个控件被封住了,也不起作用了,当用其他的
13、浏览器的时候,如:网景浏览器那个控件不会被封,但它也是不起作用的。5.Web部署项目A2.0的魅力在于您在开发 Web应用程序时无需考虑打包和部署。当需要其他类时可向 App_Code目录添加一个 .cs文件即可开始编写。 当希望将可本地化的字符串存储在资源文件中时,可向App_GlobalResources目录添加一个 .resx文件并键入字符串。一切都顺顺当当,根本就不必考虑编译和部署方面的事情。在准备进行部署时,有多种可选方案。最简单的方案是将文件复制到主运行服务器并按要求编译每一个文件(和在测试环境中一样)。第二种方案是使用_compiler.exe实用工具将应用程序预编译为二进制版本
14、,之后将只剩下要放到服务器上的一组程序集、静态内容和配置文件。第三种方案也使用_compiler.exe,但要创建一个可更新的二进制部署,其中 .as*x 文件保持不变(并且可修改),而所有代码文件都编译为二进制程序集。6. C#语言C# 是一种简洁、类型安全的面向对象的语言,开发人员可以使用它来构建在.NET Framework 上运行的各种安全、可靠的应用程序。使用C#,您可以创建传统的Windows客户端应用程序、XML Web services分布式组件、客户端- 服务器应用程序、数据库应用程序以及很多其他类型的程序。 Microsoft Visual C# 2005 提供高级代码编辑
15、器、方便的用户界面设计器、集成调试器和许多其他工具,以在C# 语言版本2.0和 .NET Framework的基础上加快应用程序的开发。C# 语法表现力强, 只有不到90 个关键字,而且简单易学。 C# 的大括号语法使任何熟悉C、C+ 或 Java 的人都可以立即上手。了解上述任何一种语言的开发人员通常在很短的时间内就可以开始使用C# 高效地工作。 C# 语法简化了C+ 的诸多复杂性,同时提供了很多强大的功能,例如可为空的值类型、枚举、委托、匿名方法和直接内存访问,这些都是 Java 所不具备的。 C# 还支持泛型方法和类型,从而提供了更出色的类型安全和性能。 C# 还提供了迭代器,允许集合类
16、的实现者定义自定义的迭代行为,简化了客户端代码对它的使用。作为一种面向对象的语言,C# 支持封装、继承和多态性概念。所有的变量和方法,包括Main 方法(应用程序的入口点),都封装在类定义中。类可能直接从一个父类继承,但它可以实现任意数量的接口。重写父类中的虚方法的各种方法要求override 关键字作为一种避免意外重定义的方式。在C# 中,结构类似于一个轻量类;它是一种堆栈分配的类型,可以实现接口,但不支持继承。除了这些 基本的面向对象的原理,C# 还通过几种创新的语言结构加快了软件组件的开发,其中包括:封装的方法签名(称为委托),它实现了类型安全的事件通知。属性 (Property),充当
17、私有成员变量的访问器。属性 (Attribute) ,提供关于运行时 类型的声明性元数据。内联 XML文档注释。在 C# 中,如果需要与其他Windows 软件(如COM对象或本机Win32 DLL )交互,可以通过一个称为“Interop的”过程来实现。互操作使 C# 程序能够完成本机 C+ 应用程序可以完成的几乎任何任务。 在直接内存访问必不可少的情况下, C# 甚至支持指针和 “不安全 ”代码的概念。C# 的生成过程比C 和 C+ 简单,比 Java 更为灵活。没有单独的头文件,也不要求按照特定顺序声明方法和类型。C# 源文件可以定义任意数量的类、结构、接口和事件。C# 程序在.NET
18、Framework 上运行,它是 Windows 的一个必要组件,包括一个称为公共语言运行时(CLR) 的虚 拟执行系统和一组统一的类库。 CLR 是 Microsoft 的公共语言基础结构(CLI)的一个商业实现。 CLI 是一种国际标准,是用于创建语言和库在其中无缝协同工作的执行和开发环境的基础。A OverviewWhen ASP was first released, Web programming was more difficult because you needed IIS to serve your ASP pages. Later, ASP.NET 2.0 and Visu
19、al Studio? 2005 made everything easier by introducing the Web site model of development. Instead of creating a new project inside Visual Studio, the Web site model lets you point to a directory and start writing pages and code. Furthermore, you can quickly test your site with the built-in ASP.NET De
20、velopment Server, which hosts ASP.NET in a local process and obviates the need to install IIS to begin developing.we will introduce 2.0 technology from different aspects.1.The .NET Framework Class LibraryASP.NET is part of Microsoft's overall .NET framework, which contains a vast set of programm
21、ing classes designed to satisfy any conceivable programming need.because Visual Basic, JScript, and C+. A great deal of the functionality of these programming languages overlaps.for example, for each language, you would have to include methods for accessingthe file system, working with databases, an
22、d manipulating strings.what s more, thes languages contain similar programming constructs, can represent loops and conditionals.Even though the syntax of a conditional written in Visual Basic differs from the syntax of a conditional written in C+, the programming function is the same. Maintaining al
23、l this functionality for multiple languages requires a lot of work. Wouldn't it be easier to create all this functionality once and use it for every language?however, The .NET Framework Class Library does exactly that. It consists of a vast set of classes designed to satisfy any conceivable prog
24、ramming need.For instance, the .NET framework contains classes for handling database access, working with the file system, manipulating text, and generating graphics. In addition, it contains more specialized classes for performing tasks such as working with regular expressions and handling network
25、protocols. furthermore, The .NET framework contains classes that represent all the basic variable data types such as strings, integers, bytes, characters, and arrays.The .NET framework is huge. It contains thousands of classes (over 3,400). Fortunately, the classes are not simply jumbled together. T
26、he classes of the .NET framework are organized into a hierarchy of namespaces.A namespace is a logical grouping of classes. For example, all the classes that relate to working with the file system are gathered together into the System.IO namespace. The namespacesare organized into a hierarchy (a log
27、ical tree). At the root of the tree is the System namespace. This namespace contains all the classes for the base data types, such as strings and arrays. It also contains classes for working with random numbers and dates and times.You can uniquely identify any class in the .NET framework by using th
28、e full namespace of the class. For example, to uniquely refer to the class that represents a file system file (the File class), you would use the following:System.IO.FileSystem.IO refers to the namespace, and File refers to the particular class.The classes contained in a select number of namespaces
29、are available in your ASP.NET pages by default. (You must explicitly import other namespaces.) These default namespaces contain classes that you use most often in your ASP.NET applications: System Contains all the base data types and other useful classes such as those related to generating random nu
30、mbers and working with dates and times.You can choose C# or JScript.NET or C+ or Visual Basic to program page. regardless of the language that you use to develop your ASP.NET pages, you need to understand that ASP.NET pages are compiled before they are executed. This means that ASP.NET pages can exe
31、cute very quickly. The first time you request an ASP.NET page, the page is compiled into a .NET class, and the resulting class file is saved beneath a special directory on your server named Temporary ASP.NET Files. For each and every ASP.NET page, a corresponding class file appears in the Temporary
32、ASP.NET Files directory.without requiring a roundtrip back to the server.Whenever you request the same ASP.NET page in the future, the corresponding class file is executed. When an ASP.NET page is compiled, it is not compiled directly into machine code. Instead, it is compiled into an intermediate-l
33、evel language called Microsoft Intermediate Language (MSIL). All .NET-compatible languages are compiled into this intermediate language. An ASP.NET page isn't compiled into native machine code until it is actually requested by a browser. At that point, the class file contained in the Temporary A
34、SP.NET Files directory is compiled with the .NET framework Just in Time (JIT) compiler and executed. The magical aspect of this whole process is that it happens automatically in the background. All you have to do is create a text file with the source code for your ASP.NET page.2.Building Forms with
35、Web Server ControlsUseingseveral of the basic Web controls to represent standard HTML form elements such as radio buttons, text boxes, and list boxes. You can use these controls in your ASP.NET pages to create the user interface for your Web application.3.Performing Form Validation with Validation C
36、ontrolsTraditionally, Web developers have faced a tough choice when adding form validation logic to their pages. You can add form validation routines to your server-side code, or you can add the validation routines to your client-side code. The advantage of writing validation logic in client-side co
37、de is that you can provide instant feedback to your usersFor. example, if a user neglects to enter a value in a required form field, you can instantly display an error messagePeople really like client-side validation. It looks great and creates a better overall user experience. The problem, however,
38、 is that it does not work with all browsers. Not all browsers support JavaScript, and different versions of browsers support different versions of JavaScript, so client-side validation is never guaranteed to work.For this reason, in the past, many developers decided to add all their form validation
39、logic exclusively to server-side code. Because server-side code functions correctly with any browser, this course of action was safer. At the same time, TheValidation controls automatically generate both client-side and server-side code. If a browser is capable of supporting JavaScript, client-side
40、validation scripts are automatically sent to the browser. If a browser is incapable of supporting JavaScript, the validation routines are automatically implemented in server-side code.Requiring Fields: The RequiredFieldValidator ControlYou use RequiredFieldValidator in a Web form to check whether a
41、control has a value. Typically, you use this control with a TextBox control. However, nothing is wrong with using RequiredFieldValidator with other input controls such as RadioButtonList.Validating Expressions: The RegularExpressionValidator ControlYou can use RegularExpressionValidator to match the
42、 value entered into a form field to a regular expression. You can use this control to check whether a user has entered, for example, a valid e-mail address, telephone number, or username or password. Samples of how to use a regular expression to perform all these validation tasks are provided in the
43、 following sections.Comparing Values: The CompareValidator ControlThe CompareValidator control performs comparisons between the data entered into a form field and another value. The other value can be a fixed value, such as a particular number, or a value entered into another control.Summarizing Err
44、ors: The ValidationSummary ControlImagine that you have a form with 50 form fields. If you use only the Validation controls discussed in the previous sections of this chapter to display errors, seeing an error message on the page might be difficult. For example, you might have to scroll down to the
45、48th form field to find the error message.Fortunately, Microsoft includes a ValidationSummary control with the Validation controls. You can use this control to summarize all the errors at the top of a page, or wherever else you want.4.Advanced Control ProgrammingWorking with View StateBy default, al
46、most all ASP.NET controls retain the values of their properties between form posts. For example, if you assign text to a Label control and submit the form, when the page is rendered again, the contents of the Label control are preserved. The magic of view state is that it does not depend on any spec
47、ial server or browser properties. In particular, it does not depend on cookies, session variables, or application variables. View state is implemented with a hidden form field called VIEWSTATE that is automatically created in every Web Forms Page. When used wisely, view state can have a dramatic and
48、 positive effect on the performance of your Web site. For example, if you display database data in a control that has view state enabled, you do not have to return to the database each time the page is posted back to the server. You can automatically preserve the data within the page's view stat
49、e between form posts.,Every control, including both HTML and Web controls, has a Visible property that determines whether the control is rendered. When a control's Visible property has the value False, the control is not displayed on the page; the control is not processed for either pre-renderin
50、g or rendering.Web controls (but not every HTML control) have an additional property named Enabled. When Enabled has the value False and you are using Internet Explorer version 4.0 or higher, the control appears ghosted and no longer functions. When used with other browsers, such as Netscape Navigat
51、or, the control might not appear ghosted, but it does not function.5.Web Deployment ProjectsThe beauty of the A 2.0 is that you can develop your Web application without thinking about packaging and deployment.when need another class ,you can Add a .cs file to the App_Code directory and start writing
52、. When want to store localizable strings in a resource file, you can add a .resx file to the App_GlobalResources directory and type in the strings. Everything just works; you don't have to think about the compilation and deployment aspect at all.When you are ready to deploy, you have several opt
53、ions. The simplest choice is to copy your files to a live server and let everything be compiled on-demand (as it was in your test environment). The second option is to use the aspnet_compiler.exe utility and precompile the application into a binary release, which leaves you nothing but a collection
54、of assemblies, static content, and configuration files to push to the server. The third option is to again use aspnet_compiler.exe, but to create an updateable binary deployment where your .as*x files remain intact (and modifiable) and all of your code files are compiled into binary assemblies.6. C#
55、 LanguageIntroduction to the C# Language and the .NET Framework C# is an elegant and type-safe object-oriented language that enables developers to build a wide range of secure and robust applications that run on the .NET Framework. You can use C# to create traditional Windows client applications, XML Web services, distributed components, client-server applications, database applications, and much, much mor
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 物业节能降耗培训课件
- 2026年新疆单招语数英智能组卷经典题集含答案按难度分层
- 2026年云南单招短视频制作与运营专业基础题库含答案脚本运营
- 2025南昌市政公用集团公开招聘【110人】笔试备考试题及答案解析
- 2026年内蒙古单招现代农业技术专业职业适应性题库含答案
- 2026年北京单招医卫大类护理医学检验专业技能模拟题含答案
- 2026年朝阳市教育局直属学校赴高校公开招聘教师(第二批次)102人笔试备考题库及答案解析
- 2026年宁波单招婴幼儿发展与健康管理专业技能模拟卷含答案
- 2025河南漯河市卫生健康委员会所属事业单位人才引进88人笔试参考题库及答案解析
- 2026年辽宁单招文化素质语文专项训练含答案古诗文阅读理解作文
- 2026元旦主题班会:马年猜猜乐猜成语 (共130题)【课件】
- 2026年太原城市职业技术学院单招综合素质考试题库汇编
- 倒运物料合同范本
- 2026年关于护士长工作计划4篇
- 2025至2030全球及中国手机用锂离子电池行业调研及市场前景预测评估报告
- 甘肃省定西市2023-2024学年八年级上学期数学期末考试试卷(含答案)
- 少年有志歌词
- 2025年一级建造师《水利水电》真题及答案解析
- 急诊科临床技术操作规范和临床诊疗指南
- 2025人民法院聘用书记员考试试题(+答案解析)
- 免疫科自身免疫性疾病治疗方案
评论
0/150
提交评论