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

下载本文档

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

文档简介

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

2、困难,因为需要IIS来处理ASP页。后来,和Visual Studio2005通过引入网站开发模型使一切工作都变得容易了。借助该网站模型,您不必在Visual Studio 中创建新项目,而是可以指向一个目录并开始编写网页和代码。此外,您还可以使用内置的 Development Server快速测试站点, Development Server将寄宿在一个本地进程中,并消除了必须安装IIS才能进行开发这一先决条件。下面从不同的方面来介绍技术。类库是微软.NET framework整体的一部分,它包含一组大量编程用的类,满足各种编程需要。因为Visual Basic、JScript和C+这些编程语

3、言的很多功能具有重叠性。举例来说,对于每一种语言,你必须包括存取文件系统、与数据库协同工作和操作字符串的方法。此外,这些语言包含相似的编程构造。都能够使用循环语句和条件语句。即使用Visual Basic写的条件语句的语法和用C+的不一样,程序的功能也是相同的。对于多种语言来说维持这一功能需要很大的工作量。那么对所有的语言创建这种功能一次,然后把这个功能用在每一种语言中岂不是更容易。然而.NET类库不完全是那样。它含有大量的满足编程需要的类。举例来说,.NET类库不仅包含处理数据库访问的类和文件协同工作,操作文本和生成图像,而且还包含更多特殊的类用在正则表达式和处理Web协议。此外.NET f

4、ramework,也包含支持所有的基本变量数据类型的类,比如:字符串、整型、字节型、字符型和数组。.NET framework是庞大的。它包含数以千计的类。(超过3,400)幸运地是,类不是简单的堆在一起。.NET framework的类被组织成有层次结构的命名空间。一个命名空间包含一组逻辑的类。举例来说,涉及到与文件系统协同工作的类就集合在命名空间中。命名空间被组织成一个层次结构(一棵逻辑树)。树根就是SYSTEM命名空间。这个命名空间包含基本的数据类型的所有的类,例如:字符串、数组,还包含提供随机数字和日期的类。你通过完整的类的命名空间能唯一识别任何的类在.NET framework中的位

5、置。例如,指定找到一个the File class类,按如下操作:.文件指命名空间,而文件指定特定的类。在默认情况下,在你的页面中,类被包含在一个选定的命名空间中这些默认的命名空间使你在中最常用到的。System命名空间-包含所有的基本数据类型和其他有用的类,例如:那些关于产生随机数字和日期的类。命名空间-包含的类是标准的集合类,例如:哈希表,数组列表。命名空间-包含特殊的集合类,例如:连接列表和字符串集合。 命名空间-包括 files类。命名空间-包含编码,解码和操作字符串内容的类。命名空间-包含的是匹配正则表达式和替代操作类。 命名空间-工作在万维网方面包含的是浏览器请求和服务器响应的类。

6、命名空间-包含页面缓冲内容和自定义缓冲操作的类。命名空间-包含执行验证和授权,例如:窗体和密码验证的类。命名空间-包含执行保存状态的类。命名空间-包含构建页面的用户接口的类。命名空间-包含HTML控件的类。命名空间-包含Web控件的类。.Net支持C#,C+和Visual Basic中的任一种语言作为你的编程语言来完成程序编写。但不管你使用什么语言开发页面,你需要明白在执行前必须编译,这就意味着执行速度非常快。第一次请求页面,页面被编译成一个.NET类,这个类文件被保存在一个特殊的目录下,这个目录的名字叫Temporary Files。对于一个页面一个通信类文件也会出现在Temporary F

7、iles目录下。以后不管任何时候你请求那个同样的页面,那个通信类文件就会执行。当页面被编译的时候,它没被直接地被编译成机器码而是被编译成了一个中间语言,名字叫MSIL,所有.NET可用的语言都被编译成这种中间语言。一个页面不会被编译成本地机器码直到它被一个浏览器访问,在那个时间点包含在Temporary Files目录下的类文件用JIT编译器编译并且执行。这些迷惑的方面体现在整个过程中且都在后台运行,你必须要做的是用资源代码为你的页面创建一个文本文件。2.用Web服务器控件创建窗体用几个基本Web控件来代替标准的HTML窗体元素,例如radiobuttons、textboxes, and li

8、stboxes.在Web应用程序中可以用这些控件创建用户界面。 3.用验证控件做页面验证传统地,当增加验证到页面中时,会面临一个严峻的选择。你可以添加窗体页面验证规则到你的服务器端代码,也可以添加验证规则到你的客户端代码。写验证代码到客户端代码中的优势能够及时反馈到你的用户。例如,一个使用者忽略输入一个要求检验的字段,你能够及时的显示一个错误信息而不需要返回到服务器端解决。人们喜欢客户端的验证。它能产生一种很好的效果。然而,问题是它不与所有的浏览器兼容。不是所有的浏览器支持JavaScript、不同版本的浏览器的不同版本支持JavaScript,所以客户端验证没有保障。由于这个原因,许多开发者

9、决定添加自定义验证到服务器端。因为服务器端代码能够和任何浏览器协同工作。这样的做法是更有安全保障。同时这些验证控件会自动地产生客户端代码和服务器端代码。如果一个浏览器有能力支持JavaScript,客户端的验证脚本将会自动返回到浏览器。如果一个浏览器不支持JavaScript,那个验证规则会自动在服务器端代码中执行。控制字段:RequiredFieldValidator控件你可以用这个控件来检查在一个Web窗体中是否为空,典型地,你和TextBox控件一起使用这个控件。然而,这个控件也可以和其他的输入型控件结合使用,例如:RadioButtonList控件。验证表达式:RegularExpre

10、ssionValidator控件你能使用RegularExpressionValidator控件来验证输入的值是否和定义的正则表达式相匹配。例如:你能使用这控件来检查一个用户是否输入一个合法的电子邮件地址,电话号码,用户名或密码。比较值:CompareValidator控件这个CompareValidator 控件用于比较一个输入的数据和另外一个值是否相同。另外一个值可能是固定值,例如:一个特定的数字或者是输入到另一个控件中的一个值。总结错误:ValidationSummary控件假想一个页面有50个字段假如你仅仅用上部分讨论的那些验证控件来显示错误看见一个错误在页面中将是很难的。例如:你可能

11、需要滚动到第48个页面字段来找到这个错误信息。幸好,微软除了包含上面提到的控件还包括ValidationSummary控件。你能用这个控件综合所有的错误信息在一个页面的上端或者你想要的任何一个地方。4.先进的控件编程保存浏览状态默认地,几乎所有的控件都会在先前的窗体中保留他们的属性值。举例来说,如果你输入文本到一个Lebel标签上然后提交那个页面,当那个页面再次被访问时那个Lebel标签的内容将会被保存下来。浏览状态的妙处是它不依赖任何的特定服务器或浏览器的属性。尤其,它不依赖cookies,session变量、或应用程序变量。浏览状态在一个名叫做VIEWSTATE的隐藏页面中执行,这个隐藏页

12、面自动创建每个Web窗体。当应用时,浏览状态能够在你的网站中产生艺术性的积极效果,例如:你在一个支持浏览状态的控件中显示数据库数据,你不需要每次都返回到需要反馈到服务器的数据库页面。它能够自动地保存页面里的数据状态。显示和隐藏内容假想把一个form变成很多页面,以便一个人每次只看那个form的一个部分。可以设置单个控件和一组控件的Visible and Enabled属性来隐藏和显示页面内容。使用Visible and Enabled属性每个控件,包括HTML和Web控件,有一个Visible 属性来决定那个控件是否可见。 当一个控件的Visible是false值,那个控件就不会在页面上显示;

13、那个控件也不会进一步运行。Web控件(不是每个HTML控件)还有一个叫Enabled的属性。当Enabled的属性是false值,你用的浏览器是或更高的版本那个控件被封住了,也不起作用了,当用其他的浏览器的时候,如:网景浏览器那个控件不会被封,但它也是不起作用的。部署项目的魅力在于您在开发Web应用程序时无需考虑打包和部署。当需要其他类时可向App_Code目录添加一个.cs文件即可开始编写。当希望将可本地化的字符串存储在资源文件中时,可向App_GlobalResources目录添加一个.resx文件并键入字符串。一切都顺顺当当,根本就不必考虑编译和部署方面的事情。在准备进行部署时,有多种可

14、选方案。最简单的方案是将文件复制到主运行服务器并按要求编译每一个文件(和在测试环境中一样)。第二种方案是使用实用工具将应用程序预编译为二进制版本,之后将只剩下要放到服务器上的一组程序集、静态内容和配置文件。第三种方案也使用,但要创建一个可更新的二进制部署,其中.as*x文件保持不变(并且可修改),而所有代码文件都编译为二进制程序集。6. C#语言C# 是一种简洁、类型安全的面向对象的语言,开发人员可以使用它来构建在 .NET Framework 上运行的各种安全、可靠的应用程序。使用 C#,您可以创建传统的 Windows 客户端应用程序、XML Web services、分布式组件、客户端

15、- 服务器应用程序、数据库应用程序以及很多其他类型的程序。Microsoft Visual C# 2005 提供高级代码编辑器、方便的用户界面设计器、集成调试器和许多其他工具,以在 C# 语言版本 和 .NET Framework 的基础上加快应用程序的开发。C# 语法表现力强,只有不到 90 个关键字,而且简单易学。C# 的大括号语法使任何熟悉 C、C+ 或 Java 的人都可以立即上手。了解上述任何一种语言的开发人员通常在很短的时间内就可以开始使用 C# 高效地工作。C# 语法简化了 C+ 的诸多复杂性,同时提供了很多强大的功能,例如可为空的值类型、枚举、委托、匿名方法和直接内存访问,这些

16、都是 Java 所不具备的。C# 还支持泛型方法和类型,从而提供了更出色的类型安全和性能。C# 还提供了迭代器,允许集合类的实现者定义自定义的迭代行为,简化了客户端代码对它的使用。作为一种面向对象的语言,C# 支持封装、继承和多态性概念。所有的变量和方法,包括 Main 方法(应用程序的入口点),都封装在类定义中。类可能直接从一个父类继承,但它可以实现任意数量的接口。重写父类中的虚方法的各种方法要求 override 关键字作为一种避免意外重定义的方式。在 C# 中,结构类似于一个轻量类;它是一种堆栈分配的类型,可以实现接口,但不支持继承。除了这些基本的面向对象的原理,C# 还通过几种创新的语

17、言结构加快了软件组件的开发,其中包括: 封装的方法签名(称为委托),它实现了类型安全的事件通知。 属性 (Property),充当私有成员变量的访问器。 属性 (Attribute),提供关于运行时类型的声明性元数据。 内联 XML 文档注释。在 C# 中,如果需要与其他 Windows 软件(如 COM 对象或本机 Win32 DLL)交互,可以通过一个称为“Interop”的过程来实现。互操作使 C# 程序能够完成本机 C+ 应用程序可以完成的几乎任何任务。在直接内存访问必不可少的情况下,C# 甚至支持指针和“不安全”代码的概念。C# 的生成过程比 C 和 C+ 简单,比 Java 更为灵

18、活。没有单独的头文件,也不要求按照特定顺序声明方法和类型。C# 源文件可以定义任意数量的类、结构、接口和事件。C# 程序在 .NET Framework 上运行,它是 Windows 的一个必要组件,包括一个称为公共语言运行时 (CLR) 的虚拟执行系统和一组统一的类库。CLR 是 Microsoft 的公共语言基础结构 (CLI) 的一个商业实现。CLI 是一种国际标准,是用于创建语言和库在其中无缝协同工作的执行和开发环境的基础。用 C# 编写的源代码被编译为一种符合 CLI 规范的中间语言 (IL)。IL 代码与资源(如位图和字符串)一起作为一种称为程序集的可执行文件存储在磁盘上,通常具有

19、的扩展名为 .exe 或 .dll。程序集包含清单,它提供关于程序集的类型、版本、区域性和安全要求等信息。执行 C# 程序时,程序集将加载到 CLR 中,这可能会根据清单中的信息执行不同的操作。然后,如果符合安全要求,CLR 执行实时 (JIT) 编译以将 IL 代码转换为本机机器指令。CLR 还提供与自动垃圾回收、异常处理和资源管理有关的其他服务。由 CLR 执行的代码有时称为“托管代码”,它与编译为面向特定系统的本机机器语言的“非托管代码”相对应。下图演示了 C# 源代码文件、基类库、程序集和 CLR 的编译时与运行时的关系。语言互操作性是 .NET Framework 的一个关键功能。因

20、为由 C# 编译器生成的 IL 代码符合公共类型规范 (CTS),因此从 C# 生成的 IL 代码可以与从 Visual Basic、Visual C+、Visual J# 的 .NET 版本或者其他 20 多种符合 CTS 的语言中的任何一种生成的代码进行交互。单一程序集可能包含用不同 .NET 语言编写的多个模块,并且类型可以相互引用,就像它们是用同一种语言编写的。除了运行时服务,.NET Framework 还包含一个由 4000 多个类组成的内容详尽的库,这些类被组织为命名空间,为从文件输入和输出到字符串操作、到 XML 分析、到 Windows 窗体控件的所有内容提供多种有用的功能。

21、典型的 C# 应用程序使用 .NET Framework 类库广泛地处理常见的“日常”任务。 OverviewWhen ASP was first released, Web programming was more difficult because you needed IIS to serve your ASP pages. Later, and Visual Studio 2005 made everything easier by introducing the Web site model of development. Instead of creating a new proj

22、ect 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 Development Server, which hosts in a local process and obviates the need to install IIS to begin will introduce technology from d

23、ifferent aspects. .NET Framework Class Library is part of Microsofts overall .NET framework, which contains a vast set of programming classes designed to satisfy any conceivable programming Visual Basic, JScript, and C+. A great deal of the functionality of these programming languages example, for e

24、ach language, you would have to include methods for accessing the file system, working with databases, and manipulating s more, these languages contain similar programming constructs, can represent loops and conditionals. Even though the syntax of a conditional written in Visual Basic differs from t

25、he syntax of a conditional written in C+, the programming function is the same. Maintaining all this functionality for multiple languages requires a lot of work. Wouldnt it be easier to create all this functionality once and use it for every language?however, The .NET Framework Class Library does ex

26、actly that. It consists of a vast set of classes designed to satisfy any conceivable programming 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

27、 performing tasks such as working with regular expressions and handling network 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 c

28、lasses (over 3,400). Fortunately, the classes are not simply jumbled together. The 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 i

29、nto the namespace. The namespaces are organized into a hierarchy (a logical 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 time

30、s.You can uniquely identify any class in the .NET framework by using the 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: refers to the namespace, and File refers to the particular class.The cla

31、sses contained in a select number of namespaces are available in your pages by default. (You must explicitly import other namespaces.) These default namespaces contain classes that you use most often in your applications: System Contains all the base data types and other useful classes such as those

32、 related to generating random numbers and working with dates and times. Contains classes for working with standard collection types such as hash tables, and array lists. Contains classes that represent specialized collections such as linked lists and string collections. Contains classes for working

33、with configuration files files). Contains classes for encoding, decoding, and manipulating the contents of strings. Contains classes for performing regular expression match and replace operations. Contains the basic classes for working with the World Wide Web, including classes for representing brow

34、ser requests and server responses. Contains classes used for caching the content of pages and classes for performing custom caching operations. Contains classes for implementing authentication and authorization such as Forms and Passport authentication. Contains classes for implementing session stat

35、e. Contains the basic classes used in building the user interface of pages. Contains the classes for the HTML controls. Contains the classes for the Web controls.You can choose C# or or C+ or Visual Basic to program page. regardless of the language that you use to develop your pages, you need to und

36、erstand that pages are compiled before they are executed. This means that pages can execute very quickly. The first time you request an 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 Files. For each and e

37、very page, a corresponding class file appears in the Temporary Files directory. Whenever you request the same page in the future, the corresponding class file is executed. When an page is compiled, it is not compiled directly into machine code. Instead, it is compiled into an intermediate-level lang

38、uage called Microsoft Intermediate Language (MSIL). All .NET-compatible languages are compiled into this intermediate language. An page isnt compiled into native machine code until it is actually requested by a browser. At that point, the class file contained in the Temporary Files directory is comp

39、iled 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 page. Forms with Web Server ControlsUseingseveral of the basic We

40、b controls to represent standard HTML form elements such as radio buttons, text boxes, and list boxes. You can use these controls in your pages to create the user interface for your Web application. Form Validation with Validation ControlsTraditionally, Web developers have faced a tough choice when

41、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 code is that you can provide instant feedback to your users. For examp

42、le, if a user neglects to enter a value in a required form field, you can instantly display an error message without requiring a roundtrip back to the 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

43、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 this reason, in the past, many developers decided to add all their form validation logic exclusively to server-side code. B

44、ecause server-side 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 se

45、nt 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 control has a value. Typically, you use

46、 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 value entered into a form field to a

47、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 following sections. Comparing Values:

48、 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 Errors: The ValidationSummary ControlIm

49、agine 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 48th form field to find the error me

50、ssage.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. Control ProgrammingWorking with View StateBy default, almost all controls retain the values of their p

51、roperties 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 do

52、es 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.

53、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 pages view state between form posts.Displaying and Hiding ContentImagine t

54、hat you want to break the tax form into multiple pages so that a person views only one part of the tax form at a can set the Visible and Enabled properties with individual controls and groups of controls to hide and display page content. Using the Visible and Enabled PropertiesEvery control, includi

55、ng both HTML and Web controls, has a Visible property that determines whether the control is rendered. When a controls 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 c

56、ontrol) have an additional property named Enabled. When Enabled has the value False and you are using Internet Explorer version 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 does

57、 not function. Deployment ProjectsThe beauty of the is that you can develop your Web application without thinking about packaging and 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 resource file, you can add a .resx

58、 file to the App_GlobalResources directory and type in the strings. Everything just works; you dont 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 a live server and let everything be compi

温馨提示

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

评论

0/150

提交评论