计算机论文中英文翻译.docx_第1页
计算机论文中英文翻译.docx_第2页
计算机论文中英文翻译.docx_第3页
计算机论文中英文翻译.docx_第4页
计算机论文中英文翻译.docx_第5页
已阅读5页,还剩11页未读 继续免费阅读

下载本文档

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

文档简介

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 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 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 microsofts overall .net framework, which contains a vast set of programming 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 accessing the file system, working with databases, and manipulating strings. whats 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 the 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 exactly that. it consists of a vast set of classes designed to satisfy any conceivable programming 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 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. 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 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. 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 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 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 contain all the base data types and other useful classes such as those related to generating random numbers and working with dates and times.system.collections contains classes for working with standard collection types such as hash tables, and array lists.system.collections.specialized contains classes that represent specialized collections such as linked lists and string collections.system.configuration contains classes for working with configuration files (web.config files).system.text contains classes for encoding, decoding, and manipulating the contents of strings.system.text.regularexpressions contains classes for performing regular expression match and replace operations.system.web contain the basic classes for working with the world wide web, including classes for representing browser requests and server responses.system.web.caching contains classes used for caching the content of pages and classes for performing custom caching operations.system.web.security contains classes for implementing authentication and authorization such as forms and passport authentication.system.web.sessionstate contains classes for implementing session state.system.web.ui contain the basic classes used in building the user interface of asp.net pages.system.web.ui.htmlcontrols contain the classes for the html controls.system.web.ui.webcontrols contain the classes for the web controls.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 execute 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 asp.net files directory. 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-level language called microsoft intermediate language (msil). all .net-compatible languages are compiled into this intermediate language. an asp.net 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 asp.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 web server controlsusingseveral 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 controlstraditionally, 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 code is that you can provide instant feedback to your users. for example, 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 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 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 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, 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 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 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 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: 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 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 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, almost 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 special 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 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 pages view state between form posts.displaying and hiding contentimagine that you want to break the tax form into multiple pages so that a person views only one part of the tax form at a time. you 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, including 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 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 navigator, 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. 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 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 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 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# 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 createtraditional windows client applications, xml web services, distributed components, client-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 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 productively 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 client code.as an object-oriented language, c# supports the concepts of encapsulation, inheritance and polymorphism. all variables and methods, including the main method, the applications entry point, are encapsulated within class definitions. a class may inherit directly from one parent class, but it may implement any number of interfaces. methods that override virtual methods in a parent class require the override keyword as a way to avoid accidental redefinition. in c#, a struct is like a lightweight class; it is a stack-allocated type that can implement interfaces but does not support inheritance.in addition to these basic object-oriented principles, c# facilitates the development of software components through several innovative language constructs, including: encapsulated method signatures called delegates, which enable type-safe event notifications. properties, which serve as accessors for private member variables. attributes, which provide declarative metadata about types at run time. inline xml documentation comments.if you need to interact with other windows software such as com objects or native win32 dlls, you can do this in c# through a process called interop. interop enables c# programs to do just about anything that a native c+ application can do. c# even supports pointers and the concept of unsafe code for those cases in which direct memory access is absolutely critical.the c# build process is simple compared to c and c+ and more flexible than in java. there are no separate header files, and no requirement that methods and types be declared in a particular order. a c# source file may define any number of classes, structs, interfaces, and events.c# programs run on the .net framework, an integral component of windows that includes a virtual execution system called the common language runtime (clr) and a unified set of class libraries. the clr is microsofts commercial implementation of the common language infrastructure (cli), an international standard that is the basis for creating execution and development environments in which languages and libraries work together seamlessly.source code written in c# is compiled into an intermediate language (il) that conforms to the cli specification. the il code, along with resources such as bitmaps and strings, is stored on disk in an executable file called an assembly, typically with an extension of .exe or .dll. an assembly contains a manifest that provides information on the assemblys types, version, culture, and security requirements.when the c# program is executed, the assembly is loaded into the clr, which might take various actions based on the information in the manifest. then, if the security requirements are met, the clr performs just in time (jit) compilation to convert the il code into native machine instructions. the clr also provides other services related to automatic garbage collection, exception handling, and resource management. code that is executed by the clr is sometimes referred to as managed code, in contrast to unmanaged code which is compiled into native machine language that targets a specific system. the following diagram illustrates the compile-time and run time relationships of c# source code files, the base class libraries, assemblies, and the clr.language interoperability is a key feature of the .net framework. because the il code produced by the c# compiler conforms to the common type specification (cts), il code generated from c# can interact with code that was generated from the .net versions of visual basic, visual c+, visual j#, or any of more than 20 other cts-compliant languages. a single assembly may contain multiple modules written in different .net languages, and the types can reference each other just as if they were written in the same language.in addition to the run

温馨提示

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

评论

0/150

提交评论