外文翻译_asp_net概述_第1页
外文翻译_asp_net概述_第2页
外文翻译_asp_net概述_第3页
外文翻译_asp_net概述_第4页
外文翻译_asp_net概述_第5页
已阅读5页,还剩12页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

1、毕业设计(论文)外文资料翻译题 目: ASP.NET 概述 院系名称: 信息科学与工程学院 专业班级: 计算机科学与技术05级6班 学生姓名: 学 号: 指导教师: 教师职称: 起止时间: 地 点 附 件: 1.外文资料翻译译文;2.外文原文。 指导教师评语:外文资料的选择与毕业设计内容密切相关,文章具有一定的难度,但译文能够较好的表达出原文的思想。专业术语运用比较准确,语句通顺,文字数量符合要求。不足之处在于个别语句的翻译缺乏润色,有些牵强。总之,译文符合要求,反映出学生具有较好的专业外文阅读和翻译能力。 签名: 2009年 3 月 2 日ASP.NET概述当ASP第一次发布时,Web编程还

2、比较困难,因为需要IIS来处理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.NET页面,你需要明白ASP.NET在执行前必须编译,

6、这就意味着ASP.NET执行速度非常快。第一次请求ASP.NET页面,页面被编译成一个.NET类,这个类文件被保存在一个特殊的目录下,这个目录的名字叫Temporary ASP.NET Files。对于一个ASP.NET页面一个通信类文件也会出现在Temporary ASP.NET Files目录下。以后不管任何时候你请求那个同样的ASP.NET页面,那个通信类文件就会执行。当ASP.NET页面被编译的时候,它没被直接地被编译成机器码而是被编译成了一个中间语言,名字叫MSIL,所有.NET可用的语言都被编译成这种中间语言。一个ASP.NET页面不会被编译成本地机器码直到它被一个浏览器访问,在那

7、个时间点包含在Temporary ASP.NET Files目录下的类文件用JIT编译器编译并且执行。这些迷惑的方面体现在整个过程中且都在后台运行,你必须要做的是用资源代码为你的ASP.NET页面创建一个文本文件。2.用Web服务器控件创建窗体用几个基本Web控件来代替标准的HTML窗体元素,例如radiobuttons、textboxes, and listboxes.在Web应用程序中可以用这些控件创建用户界面。 3.用验证控件做页面验证传统地,当增加验证到页面中时,会面临一个严峻的选择。你可以添加窗体页面验证规则到你的服务器端代码,也可以添加验证规则到你的客户端代码。写验证代码到客户端代

8、码中的优势能够及时反馈到你的用户。例如,一个使用者忽略输入一个要求检验的字段,你能够及时的显示一个错误信息而不需要返回到服务器端解决。人们喜欢客户端的验证。它能产生一种很好的效果。然而,问题是它不与所有的浏览器兼容。不是所有的浏览器支持JavaScript、不同版本的浏览器的不同版本支持JavaScript,所以客户端验证没有保障。由于这个原因,许多开发者决定添加自定义验证到服务器端。因为服务器端代码能够和任何浏览器协同工作。这样的做法是更有安全保障。同时这些验证控件会自动地产生客户端代码和服务器端代码。如果一个浏览器有能力支持JavaScript,客户端的验证脚本将会自动返回到浏览器。如果一

9、个浏览器不支持JavaScript,那个验证规则会自动在服务器端代码中执行。控制字段:RequiredFieldValidator控件你可以用这个控件来检查在一个Web窗体中是否为空,典型地,你和TextBox控件一起使用这个控件。然而,这个控件也可以和其他的输入型控件结合使用,例如:RadioButtonList控件。验证表达式:RegularExpressionValidator控件你能使用RegularExpressionValidator控件来验证输入的值是否和定义的正则表达式相匹配。例如:你能使用这控件来检查一个用户是否输入一个合法的电子邮件地址,电话号码,用户名或密码。比较值:Co

10、mpareValidator控件这个CompareValidator 控件用于比较一个输入的数据和另外一个值是否相同。另外一个值可能是固定值,例如:一个特定的数字或者是输入到另一个控件中的一个值。总结错误:ValidationSummary控件假想一个页面有50个字段假如你仅仅用上部分讨论的那些验证控件来显示错误看见一个错误在页面中将是很难的。例如:你可能需要滚动到第48个页面字段来找到这个错误信息。幸好,微软除了包含上面提到的控件还包括ValidationSummary控件。你能用这个控件综合所有的错误信息在一个页面的上端或者你想要的任何一个地方。4.先进的控件编程保存浏览状态默认地,几乎所

11、有的ASP.NET控件都会在先前的窗体中保留他们的属性值。举例来说,如果你输入文本到一个Lebel标签上然后提交那个页面,当那个页面再次被访问时那个Lebel标签的内容将会被保存下来。浏览状态的妙处是它不依赖任何的特定服务器或浏览器的属性。尤其,它不依赖cookies,session变量、或应用程序变量。浏览状态在一个名叫做VIEWSTATE的隐藏页面中执行,这个隐藏页面自动创建每个Web窗体。当应用时,浏览状态能够在你的网站中产生艺术性的积极效果,例如:你在一个支持浏览状态的控件中显示数据库数据,你不需要每次都返回到需要反馈到服务器的数据库页面。它能够自动地保存页面里的数据状态。使用Visi

12、ble and Enabled属性每个控件,包括HTML和Web控件,有一个Visible 属性来决定那个控件是否可见。 当一个控件的Visible是false值,那个控件就不会在页面上显示;那个控件也不会进一步运行。Web控件(不是每个HTML控件)还有一个叫Enabled的属性。当Enabled的属性是false值,你用的浏览器是IE4.0或更高的版本那个控件被封住了,也不起作用了,当用其他的浏览器的时候,如:网景浏览器那个控件不会被封,但它也是不起作用的。5.Web部署项目A2.0的魅力在于您在开发Web应用程序时无需考虑打包和部署。当需要其他类时可向App_Code目录添加一个.cs文

13、件即可开始编写。当希望将可本地化的字符串存储在资源文件中时,可向App_GlobalResources目录添加一个.resx文件并键入字符串。一切都顺顺当当,根本就不必考虑编译和部署方面的事情。在准备进行部署时,有多种可选方案。最简单的方案是将文件复制到主运行服务器并按要求编译每一个文件(和在测试环境中一样)。第二种方案是使用_compiler.exe实用工具将应用程序预编译为二进制版本,之后将只剩下要放到服务器上的一组程序集、静态内容和配置文件。第三种方案也使用_compiler.exe,但要创建一个可更新的二进制部署,其中.as*x文件保持不变(并且可修改),而所有代码文件都编译为二进制程

14、序集。6. C#语言C# 是一种简洁、类型安全的面向对象的语言,开发人员可以使用它来构建在 .NET Framework 上运行的各种安全、可靠的应用程序。使用 C#,您可以创建传统的 Windows 客户端应用程序、XML Web services、分布式组件、客户端 - 服务器应用程序、数据库应用程序以及很多其他类型的程序。Microsoft Visual C# 2005 提供高级代码编辑器、方便的用户界面设计器、集成调试器和许多其他工具,以在 C# 语言版本 2.0 和 .NET Framework 的基础上加快应用程序的开发。C# 语法表现力强,只有不到 90 个关键字,而且简单易学。

15、C# 的大括号语法使任何熟悉 C、C+ 或 Java 的人都可以立即上手。了解上述任何一种语言的开发人员通常在很短的时间内就可以开始使用 C# 高效地工作。C# 语法简化了 C+ 的诸多复杂性,同时提供了很多强大的功能,例如可为空的值类型、枚举、委托、匿名方法和直接内存访问,这些都是 Java 所不具备的。C# 还支持泛型方法和类型,从而提供了更出色的类型安全和性能。C# 还提供了迭代器,允许集合类的实现者定义自定义的迭代行为,简化了客户端代码对它的使用。作为一种面向对象的语言,C# 支持封装、继承和多态性概念。所有的变量和方法,包括 Main 方法(应用程序的入口点),都封装在类定义中。类可

16、能直接从一个父类继承,但它可以实现任意数量的接口。重写父类中的虚方法的各种方法要求 override 关键字作为一种避免意外重定义的方式。在 C# 中,结构类似于一个轻量类;它是一种堆栈分配的类型,可以实现接口,但不支持继承。除了这些基本的面向对象的原理,C# 还通过几种创新的语言结构加快了软件组件的开发,其中包括:· 封装的方法签名(称为委托),它实现了类型安全的事件通知。· 属性 (Property),充当私有成员变量的访问器。 · 属性 (Attribute),提供关于运行时类型的声明性元数据。 · 内联 XML 文档注释。在 C# 中,如果需要与

17、其他 Windows 软件(如 COM 对象或本机 Win32 DLL)交互,可以通过一个称为“Interop”的过程来实现。互操作使 C# 程序能够完成本机 C+ 应用程序可以完成的几乎任何任务。在直接内存访问必不可少的情况下,C# 甚至支持指针和“不安全”代码的概念。C# 的生成过程比 C 和 C+ 简单,比 Java 更为灵活。没有单独的头文件,也不要求按照特定顺序声明方法和类型。C# 源文件可以定义任意数量的类、结构、接口和事件。C# 程序在 .NET Framework 上运行,它是 Windows 的一个必要组件,包括一个称为公共语言运行时 (CLR) 的虚拟执行系统和一组统一的类

18、库。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 Visual Studio® 2005 made everything easier by introducing the Web

19、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 Development Server, which hosts ASP.NET in a local process and o

20、bviates 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 programming classes designed to satisfy any conceivable programming ne

21、ed.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 accessing the file system, working with databases, and manipulating strings.whats more, these languages contain si

22、milar 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 all this functionality for multiple languages requires a lot o

23、f 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 programming need.For instance, the .NET framework contains class

24、es 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 protocols. furthermore, The .NET framework contains classes

25、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. The classes of the .NET framework are organized into a hierar

26、chy 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 namespaces are organized into a hierarchy (a logical tree). At the root of the tree is the System namespace

27、. 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 the full namespace of the class. For example, to uniquely ref

28、er 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 are available in your ASP.NET pages by default. (You must e

29、xplicitly 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 numbers and working with dates and times.You can choose C# or

30、 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 execute very quickly. The first time you request an ASP.NET pa

31、ge, 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 ASP.NET Files directory. Whenever you request the same ASP.

32、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-level language called Microsoft Intermediate Language (MSIL). All .NET-compatible languages are compiled int

33、o 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 ASP.NET Files directory is compiled with the .NET framework Just in Time (JIT) compiler and executed. The ma

34、gical 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 Web Server ControlsUseingseveral of the basic Web controls to represent standard HTML form elements such as

35、 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 ControlsTraditionally, Web developers have faced a tough choice when adding form validation logic to their p

36、ages. 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 code is that you can provide instant feedback to your users. For example, if a user neglects to enter a value

37、 in a required form field, you can instantly display an error message without requiring a roundtrip back to the server.People really like client-side validation. It looks great and creates a better overall user experience. The problem, however, is that it does not work with all browsers. Not all bro

38、wsers 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 logic exclusively to server-side code. Because server-si

39、de code functions correctly with any browser, this course of action was safer. At the same time, The Validation controls automatically generate both client-side and server-side code. If a browser is capable of supporting JavaScript, client-side validation scripts are automatically sent to the browse

40、r. 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 control has a value. Typically, you use this control wi

41、th 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 value entered into a form field to a regular expressi

42、on. 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 following sections. Comparing Values: The CompareVali

43、dator 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 Errors: The ValidationSummary ControlImagine that you h

44、ave 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 48th form field to find the error message.Fortunatel

45、y, 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, almost all ASP.NET controls retain the values of their

46、 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 special server or browser properties. In particular, it

47、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 positive effect on the performance of your Web site

48、. 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 state between form posts.,Every control, including both

49、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-rendering or rendering.Web controls (but not every HTML cont

50、rol) 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 Navigator, the control might not appear ghosted, but it doe

51、s 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. When want to store localizable strings in a resour

52、ce 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 options. The simplest choice is to copy your files to

53、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 of assemblies, static content, and configuration fi

54、les 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# LanguageIntroduction to the C# Language and the .N

55、ET 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 createtraditional Windows client applications, XML Web services, distributed components, client

56、-server applications, database applications, and much, much more. Microsoft Visual C# 2005 provides an advanced code editor, convenient user interface designers, integrated debugger, and many other tools to facilitate rapid application development based on version 2.0 of the C# language and the .NET

57、 Framework.C# syntax is highly expressive, yet with less than 90 keywords, it is also simple and easy to learn. The curly-brace syntax of C# will be instantly recognizable to anyone familiar with C, C+ or Java. Developers who know any of these languages are typically able to begin working productive

58、ly in C# within a very short time. C# syntax simplifies many of the complexities of C+ while providing powerful features such as nullable value types, enumerations, delegates, anonymous methods and direct memory access, which are not found in Java. C# also supports generic methods and types, which provide increased type safety and performance, and iterators, which enable implementers of collection classes to define custom iteration behaviors that are simple to use by

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论