關于的外國文獻_第1頁
關于的外國文獻_第2頁
關于的外國文獻_第3頁
關于的外國文獻_第4頁
關于的外國文獻_第5頁
已閱讀5頁,還剩2頁未讀, 繼續(xù)免費閱讀

下載本文檔

版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進行舉報或認領

文檔簡介

1、關于A 概述的外國文獻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 mo del of development. Instead of creating a new project inside Visual Stu

2、dio, 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 Developmen t Server, which hosts ASP.NET in a local process and obviates the need to install IIS to begin developing.we will introduce 2.0 tec

3、hnology from different aspects.1.The .NET Framework Class Library 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 mani

4、pulating strings.whats more, these languages contain similar programming constructs, can represent loops and cond itionals. Even though the syntax of a conditional written in Visual Basic differs from the syntax of a c onditional written in C+, the programming function is the same. Maintaining all t

5、his 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 conceivabl e programming

6、 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 han ling network protoco

7、ls. 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 jum bled together. The cla

8、sses 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 hierarch y (a logical

9、 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 fu

10、ll namespace of the class. For example, to uniquely refer to the class that represents a file syste m file (the File class), you would use the following:System.IO refers to the namespace, and File refers to the particular class.The classes contained in a select number of namespaces are available in

11、your ASP.NET pages b y 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 numbers and workin

12、g with dates and times.System.Collections Contains classes for worki ng 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

13、 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 C ontains the basic

14、 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

15、authentication and authorization such as Forms and Passport authentication.System.Web.SessionState Contains classes for implementing session state.System.Web.UI Contains the basic classes used in building the user interface of ASP.NET pages. TMLControls Contains the classes for the HTML controls.Sys

16、tem.Web.UI.WebControls Contains 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

17、that ASP.NET pages can execute very quickly. The first time you request an ASP.NET page, the page is compiled into a .N ET 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 fil

18、e appears in the Temporary ASP.NET Files directory. Whenever you request the same ASP.NET page in the future, the correspo nding class file is executed. When an A SP.NET page is compiled, it is not compiled directly into machine code. Instead, it is compiled into an intermediate-level language calle

19、d Micros ft Intermediate Language (MSIL). All .NET-compatible languages are compiled into this intermediate language. An ASP.NET page isn t compiled into ative machine code until it is actually requested by a browser. At that point, the class file contained in the Temporary ASP.NET Files directory i

20、s 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 ControlsUsein

21、gseveral 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 pa ges to create the user interface for your Web application.3.Performing Form Validation with Validation ControlsTraditionally, W

22、eb 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 prov

23、ide 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 me ssage without requiring a roundtrip back to the server.People really like client-side validation. It looks great and creates a better overall user expe

24、rience. The pr port 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 ser

25、ve r-side code functions correctly with any browser, this course o f 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 th

26、e 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 co

27、ntrol 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 regu lar

28、 expression. You can use this control to check whether a user has entered, for example, a valid e-mail address, telep hone number, or username or password. Samples of how to use a regular expression to perform all these validation tasks are provided in the foll owing sections. Comparing Va ues: The

29、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

30、 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

31、.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.Web Deployment ProjectsThe beauty of the A 2.0 is that you can develop your Web application without thinki

32、ng 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 fil , you can add a .resx file to the App_GlobalResources directory and type in the strings. Everything just works; you

33、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 file 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 aspn

34、et_compiler.exe utility and precompile the application into a binary release, whi h leaves you nothing but a collection of assemblies, static content, and configuration files to push to the server. The thir d option is to again use aspnet_compiler.exe, but to create an updateable binary deployment w

35、here your .as*x fil es remain intact (and modifiable) and all of your code files are compiled into binary assemblies.5.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

36、to a Label control and submit the form, when the page is rendered again, the contents of he Label control are preserved. The magic of view state is that it does not depend on any special server or browser proper ties. In particular, it does not depend on cookies, session variables, or application va

37、riables. View state is implem ented with a hidden form field called VIEWSTATE tha t is automatically created in every Web Forms Page. When used wisely, view state can have a dra mati c and positive effect on the performance of your W eb site. For example, if you display database data in a co ntrol t

38、hat has view state enabled, you do not have t o 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

39、so that a person views only one part of the tax form at a time.you can set the Visible and Enabled prop erties with individua l 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

40、 property that determines w hether the control is rendered. When a controls Visible property has the value False, the control is not displayed on th page; the control is not processed for either pre-rendering or rendering.Web controls (but not every HTML control) have an additional property named En

41、abled. When Enable d has the value False and you are using Inte rnet 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 n ot function.6. C# LanguageIntroduct

42、ion to the C# Language and the .NET Framework C# is an elegant and type-safe object-oriented langu age 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, di

43、stributed components, client-server applications, database ap plications, 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 o

44、f 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 ab

45、le to begin working productively in C# within a very short time. C# syntax simplifies man y 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 gen

46、eric methods and types, which provide increased type safety and performance, and i 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 applic

47、ations entry point, are encapsulated within class definitions. A class may inherit directly from one parent class, but it may implemen t any number of interfaces. Methods that override virtual methods in a par ent class require the override keyword as a way to avoid accidental redefinition. In C#, a

48、 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: Enc

49、apsulated method signatures called delegates, which enable type-safe event notifications. Pro perties, 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 W

50、indows 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 support cess is abso lutely critical.The C# build process is simple compared to C and C

51、+ and more flexible than in Java. There are no separate header file s, and no requirement that methods and types be declared in a particular order. A C# source file may define any number of classes, structs, interfac es, and events.C# programs run on the .NET Framework, an integral component of Wind

52、ows 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

53、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

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預覽,若沒有圖紙預覽就沒有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負責。
  • 6. 下載文件中如有侵權(quán)或不適當內(nèi)容,請與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

評論

0/150

提交評論