版權(quán)說(shuō)明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡(jiǎn)介
1、 外 文 翻 譯畢業(yè)設(shè)計(jì)題目: 基于ASP.NET的 物業(yè)管理系統(tǒng)開(kāi)發(fā) 原文1: ASP.NET 2.0 Web Pages and Web Controls 譯文1: ASP.NET 2.0 網(wǎng)頁(yè)和Web控件 原文2:The Role of Global.asax File譯文2: Global.asax文件的作用 原文1ASP.NET 2.0 Web Pages and Web ControlsUntil now, all of the example applications in this text have focused on console-based and Windows F
2、orms front ends. In this chapter and the next, youll explore how the .NET platform facilitates the construction of browser-based presentation layers. To begin, youll quickly review a number of key web-centric concepts (HTTP, HTML, client-side, and server-side script) and the role of the web server (
3、including the ASP.NET development server, WebDev.WebServer.exe).With this web primer out of the way, the remainder of this chapter concentrates on the composition of ASP.NET (including the enhanced code-behind model) and how to work with ASP.NET web controls. As you will see, ASP.NET 2.0 provides a
4、number of new web controls, a new “master page”model, and various customization techniques.The Role of HTTPWeb applications are very different animals from traditional desktop applications (to say the least).The first obvious difference is that a production-level web application will always involve
5、at least two networked machines (of course, during development it is entirely possible to have a single machine play the role of both client and server). Given this fact, the machines in question must agree upon a particular wire protocol to determine how to send and receive data. The wire protocol
6、that connects the computers in question is the Hypertext Transfer Protocol (HTTP).When a client machine launches a web browser (such as Netscape Navigator, Mozilla Firefox,or Microsoft Internet Explorer), an HTTP request is made to access a particular resource (such as an *.aspx or *.htm file) on th
7、e remote server machine. HTTP is a text-based protocol that is built upon a standard request/response paradigm. For example, if you navigate to www. IntertechT, the browser software leverages a web technology termed Domain Name Service (DNS) that converts the registered URL into a four-pa
8、rt, 32-bit numerical value (aka an IP address). At this point, the browser opens a socket connection (typically via port 80) and sends the HTTP request for the default page at the http:/www.IntertechT website.Once the hosting web server receives the incoming HTTP request, the specified re
9、source may contain logic that scrapes out any client-supplied input values (such as values within a text box) in order to format a proper HTTP response. Web programmers may leverage any number of technologies(CGI, ASP, ASP.NET, Java servlets, etc.) to dynamically generate the content to be emitted i
10、nto the HTTP response. At this point, the client-side browser renders the HTML emitted from the web server. Another aspect of web development that is markedly different from traditional desktop programming is the fact that HTTP is an essentially stateless wire protocol. As soon as the web server emi
11、ts a response to the client, everything about the previous interaction is forgotten. Therefore, as a web developer, it is up to you take specific steps to “remember” information (such as items in a shopping cart) about the clients who are currently logged on to your site. As you will see in the next
12、 chapter, ASP.NET provides numerous ways to handle state, many of which are commonplace to any web platform (session variables, cookies, and application variables) as well as some new techniques (view state, control state, and the cache).Understanding Web Applications and Web ServersA web applicatio
13、n can be understood as a collection of files (*.htm, *.asp, *.aspx, image files, etc.) and related components (such as a .NET code library) stored within a particular set of directories on a given web server. As shown in Chapter 24, web applications have a specific life cycle and provide numerous ev
14、ents (such as initial startup or final shutdown) that you can hook into.A web server is a software product in charge of hosting your web applications, and it typically provides a number of related services such as integrated security, File Transfer Protocol (FTP) support, mail exchange services, and
15、 so forth. Internet Information Server (IIS) is Microsofts enterprise-level web server product, and as you would guess, it has intrinsic support for classic ASP as well as ASP.NET web applications.When you build ASP.NET web applications, you will often need to interact with IIS. Be aware, however, t
16、hat IIS is not automatically selected when you install the Windows Server 2003 or Windows XP Professional Edition (you cant install IIS on the Home editions of Windows). Therefore, depending on the configuration of your development machine, you may be required to manually install IIS before proceedi
17、ng through this chapter. To do so, simply access the Add/Remove Program applet from the Control Panel folder and select Add/Remove Windows Components.Working with IIS Virtual DirectoriesA single IIS installation is able to host numerous web applications, each of which resides in a virtual directory.
18、 Each virtual directory is mapped to a physical directory on the local hard drive. Therefore, if you create a new virtual directory named CarsRUs, the outside world can navigate to this site using a URL such as http:/www.CarsRU (assuming your sites IP address has been registered with the world
19、at large). Under the hood, the virtual directory maps to a physical root directory such as C:inetpubwwwrootAspNetCarsSite, which contains the content of the web application.When you create ASP.NET web applications using Visual Studio 2005, you have the option of generating a new virtual directory fo
20、r the current website. However, you are also able to manually create a virtual directory by hand. For the sake of illustration, assume you wish to create a simple web application named Cars. The first step is to create a new folder on your machine to hold the collection of files that constitute this
21、 new site (e.g., C:CodeTestsCarsWebSite).Next, you need to create a new virtual directory to host the Cars site. Simply right-click the Default Web Site node of IIS and select New Virtual Directory from the context menu. This menu selection launches an integrated wizard. Skip past the welcome screen
22、 and give your website a name (Cars). Next, you are asked to specify the physical folder on your hard drive that contains the various files and images that represent this site (in this case, C:CodeTestsCarsWebSite).The final step of the wizard prompts you for some basic traits about your new virtual
23、 directory (such as read/write access to the files it contains, the ability to view these files from a web browser, the ability to launch executables e.g., CGI applications, etc.). For this example, the default selections are just fine (be aware that you can always modify your selections after runni
24、ng this tool using various right-click Property dialog boxes integrated within IIS).譯文1作者:迪諾弗雷國(guó)籍:美國(guó)出處:ASP.NET 2.0 and Data-Bound ControlsASP.NET 2.0網(wǎng)頁(yè)和Web控件到現(xiàn)在為止,本書(shū)的示例應(yīng)用程序主要集中在控制臺(tái)和基于Windows窗體前端。在本章及下面學(xué)習(xí)中,將探討如何用.NET平臺(tái)促進(jìn)瀏覽器的建設(shè)。首先,你很快就會(huì)再次看到關(guān)于網(wǎng)絡(luò)中心的概念(HTTP,HTML格式,客戶端和服務(wù)器端腳本)和web服務(wù)器(包括ASP.NET開(kāi)發(fā)服務(wù)器,WebDev.
25、WebServer作用。exe文件)。了這一點(diǎn),本章的剩余部分主要是ASP網(wǎng)絡(luò)(包括增強(qiáng)的代碼隱藏模型),以及如何使用ASP.NET Web控件和ASP.NET組成。正如你所看到的,ASP.NET 2.0提供了一些新的網(wǎng)絡(luò)控制模式,新的“母版頁(yè)”的模式,以及各種定制技術(shù)。HTTP的作用Web應(yīng)用程序不同于傳統(tǒng)的桌面應(yīng)用程序。第一個(gè)明顯不同的是,產(chǎn)生Web應(yīng)用程序?qū)⒅辽偕婕皟膳_(tái)聯(lián)網(wǎng)的機(jī)器(當(dāng)然在開(kāi)發(fā)過(guò)程中完全有可能有一臺(tái)機(jī)器扮演客戶端和服務(wù)器角色)。鑒于這一事實(shí),機(jī)器必須確定一個(gè)特定的有線協(xié)議,以確定如何發(fā)送和接收數(shù)據(jù)。線路協(xié)議,關(guān)系到計(jì)算機(jī)的問(wèn)題是超文本傳遞協(xié)議(HTTP)。當(dāng)客戶機(jī)啟動(dòng)一個(gè)(
26、如Netscape Navigator,Mozilla Firefox瀏覽器,或Microsoft Internet Explorer)瀏覽器,一個(gè)HTTP請(qǐng)求訪問(wèn)(如*. aspx或*. htm文件)在遠(yuǎn)程服務(wù)器上的特定資源。 HTTP是一個(gè)基于文本的協(xié)議,是建立在一個(gè)標(biāo)準(zhǔn)的請(qǐng)求/響應(yīng)式。例如,如果導(dǎo)航到http:/www.IntertechT,瀏覽器軟件利用網(wǎng)絡(luò)技術(shù)網(wǎng)域名稱服務(wù)(DNS)轉(zhuǎn)換成由四個(gè)部分組成,32位數(shù)值(又名IP地址)注冊(cè)的網(wǎng)址。此時(shí),瀏覽器打開(kāi)一個(gè)(通常是通過(guò)端口80)套接字連接和發(fā)送的默認(rèn)HTTP網(wǎng)頁(yè)上http:/www.IntertechTrai
27、要求。一旦托管的Web服務(wù)器接收 發(fā)送來(lái)的HTTP請(qǐng)求,指定的資源可能包含邏輯輸入值(例如在一個(gè)文本框的值),以便以適當(dāng)?shù)母袷交貜?fù)HTTP響應(yīng)。 Web程序員可以利用任何技術(shù)(共同閘道介面,的ASP,ASP.NET,Java Servlets和等)來(lái)動(dòng)態(tài)生成納入HTTP響應(yīng)的內(nèi)容。此時(shí),客戶端的HTML瀏覽器從Web服務(wù)器發(fā)出的請(qǐng)求。網(wǎng)絡(luò)的另一個(gè)顯著的發(fā)展是從傳統(tǒng)的桌面程序變成HTTP的無(wú)國(guó)界有線協(xié)議。只要服務(wù)器發(fā)出響應(yīng)客戶,所有關(guān)于以前的交互作用被遺忘了。因此,作為Web開(kāi)發(fā)人員,它是由你采取具體步驟,以“記住”信息(如在購(gòu)物車中的物品)有關(guān)目前誰(shuí)登錄到您的站點(diǎn)。你會(huì)在下一章
28、看到,ASP.NET提供了許多方法來(lái)處理狀態(tài),其中許多是很常見(jiàn)網(wǎng)絡(luò)平臺(tái)(會(huì)話變量,Cookie和應(yīng)用程序變量)以及一些新技術(shù)(視圖狀態(tài),控制狀態(tài),和緩存)。了解Web應(yīng)用程序和Web服務(wù)器一個(gè)web應(yīng)用程序可以被理解為一個(gè)檔案集合(*.熱媒,*. asp和*.的ASPX,圖像文件等)和(如相關(guān)的組件。NET代碼庫(kù))在一組特定的目錄中存儲(chǔ)給定的Web服務(wù)器。如第24章所示,Web應(yīng)用程序有一個(gè)特定的生命周期,并提供了許多活動(dòng)(如初始啟動(dòng)或最后關(guān)閉),可以連接到。Web服務(wù)器是 接管網(wǎng)絡(luò)應(yīng)用的軟件產(chǎn)品,而且通常提供集成安全等一系列相關(guān)服務(wù)的數(shù)量,文件傳輸協(xié)議(FTP)的支持,郵件交換服務(wù),等等?;?/p>
29、聯(lián)網(wǎng)信息服務(wù)(IIS)是微軟的企業(yè)級(jí)Web服務(wù)器的產(chǎn)品,它內(nèi)在的支持傳統(tǒng)的ASP以及ASP.NET Web應(yīng)用程序。當(dāng)你建立ASP.NET Web應(yīng)用程序,你會(huì)經(jīng)常需要與IIS進(jìn)行交互。請(qǐng)注意,IIS是不會(huì)自動(dòng)選擇安裝Windows Server 2003或Windows XP專業(yè)版(無(wú)法安裝在Windows家用版IIS)的。因此,在你的開(kāi)發(fā)機(jī)器配置不同時(shí),您可能需要手動(dòng)安裝本章所說(shuō)的IIS程序。為此,只需訪問(wèn)添加/從控制面板文件夾刪除程序小程序并選擇添加/刪除Windows組件。工作與IIS虛擬目錄在每一個(gè)虛擬目錄里單一的IIS有能力辦好許多Web應(yīng)用程序。每一個(gè)虛擬目錄映射到本地硬盤(pán)驅(qū)動(dòng)器
30、的物理目錄。因此,如果您創(chuàng)建一個(gè)新的虛擬目錄名為CarsRUs,外界可以瀏覽到這個(gè)網(wǎng)站使用的網(wǎng)址,如http:/www.CarsRU(假設(shè)您的網(wǎng)站的IP地址已經(jīng)與整個(gè)世界的登記)。在內(nèi)部,該虛擬目錄映射到一個(gè)物理根目錄,如C: inetpub wwwroot的 AspNetCarsSite,其中包含Web應(yīng)用程序的內(nèi)容。當(dāng)您創(chuàng)建ASP.NET Web應(yīng)用程序使用Visual Studio 2005,您可以產(chǎn)生一個(gè)新的當(dāng)前網(wǎng)站的虛擬目錄選項(xiàng)。不過(guò),你也可以手動(dòng)創(chuàng)建一個(gè)虛擬目錄。為了說(shuō)明起見(jiàn),假設(shè)你想創(chuàng)建一個(gè)簡(jiǎn)單的Web應(yīng)用程序命名為汽車。第一步是創(chuàng)建一個(gè)你新文件夾以保存文件,構(gòu)成新的網(wǎng)
31、站(例如,C: CodeTests CarsWebSite)集合。下面,需要?jiǎng)?chuàng)建一個(gè)新的虛擬目錄舉辦汽車的網(wǎng)站。只需右鍵單擊默認(rèn)Web站點(diǎn)的IIS節(jié)點(diǎn),然后從上下文菜單中選擇New虛擬目錄。此菜單選擇啟動(dòng)一個(gè)綜合向?qū)?。跳過(guò)過(guò)去的歡迎屏幕,是你的網(wǎng)站的名稱(汽車)。接下來(lái),您被要求指定您的硬盤(pán)驅(qū)動(dòng)器包含各種文件和圖像的物理文件夾代表本網(wǎng)站(在此情況下,C: CodeTests CarsWebSite)。在向?qū)У淖詈笠徊綍?huì)提示你新的虛擬目錄(如讀/寫(xiě)訪問(wèn)的文件它包含了一些基本特征你,能夠從一個(gè)網(wǎng)頁(yè)瀏覽器這些文件,能夠發(fā)射可執(zhí)行文件例如,共同閘道介面應(yīng)用等)。在這個(gè)例子中,只是默認(rèn)選擇(注意,您可以
32、隨時(shí)修改運(yùn)行此工具后,使用不同的用鼠標(biāo)右鍵單擊屬性對(duì)話框在IIS集成箱您的選擇)。 原文2The Role of the Global.asax FileAt this point, an ASP.NET application may seem to be little more than a set of *.aspx files and their respective web controls. While you could build a web application by simply linking a set of related web pages, you will m
33、ost likely need a way to interact with the web application as a whole. To this end, your ASP.NET web applications may choose to include an optional Global.asax file via the WebSite.Add New Item menu option.Simply put, Global.asax is just about as close to a traditional double-clickable *.exe that we
34、 can get in the world of ASP.NET, meaning this type represents the runtime behavior of the website itself. Once you insert a Global.asax file into a web project, you will notice it is little more than a block containing a set of event handlers:void Application_Start(Object sender, EventArgs e)/ Code
35、 that runs on application startupvoid Application_End(Object sender, EventArgs e)/ Code that runs on application shutdownvoid Application_Error(Object sender, EventArgs e)/ Code that runs when an unhandled error occursvoid Session_Start(Object sender, EventArgs e)/ Code that runs when a new session
36、is startedvoid Session_End(Object sender, EventArgs e)/ Code that runs when a session endsLooks can be deceiving, however. At runtime, the code within this block is assembled into a class type deriving from System.Web.HttpApplication. If you have a background in ASP.NET 1.x, you may recall that the
37、Global.asax code-behind file literally did define a class deriving from HttpApplication.The Global Last Chance Exception Event Handler First, let me point out the role of the Application_Error() event handler. Recall that a specific page may handle the Error event to process any unhandled exception
38、that occurred within the scope of the page itself. In a similar light, the Application_Error() event handler is the final place to handle an exception that was not handled by a specific page. As with the page-level Error event, you are able to access the specific System.Exception using the inherited
39、 Server property: void Application_Error(Object sender, EventArgs e)Exception ex = Server.GetLastError();Response.Write(ex.Message);Server.ClearError();Given that the Application_Error() event handler is the last chance exception handler for your web application, odds are that you would rather not r
40、eport the error to the user, but you would like to log this information to the web servers event log, for example:.void Application_Error(Object sender, EventArgs e)/ Log last error to event log.Exception ex = Server.GetLastError();EventLog ev = new EventLog(Application);ev.WriteEntry(ex.Message, Ev
41、entLogEntryType.Error);Server.ClearError();Response.Write(This app has bombed. Sorry!);The HttpApplication Base Class As mentioned, the Global.asax script is dynamically generated into a class deriving from the System.Web.HttpApplication base class, which supplies the same sort of functionality as t
42、he System.Web.UI.Page type.Application This property allows you to interact with application-level variables, using the exposed HttpApplicationState type.Request This property allows you to interact with the incoming HTTP request (via HttpRequest).Response This property allows you to interact with t
43、he incoming HTTP response (via HttpResponse).Server This property gets the intrinsic server object for the current request (via HttpServerUtility).Session This property allows you to interact with session-level variables, using the exposed HttpSessionState type.譯文2作者:P.S.Yu, H.Heiss, and D.M.Dias國(guó)籍:
44、德國(guó)出處:ASP.NET 2.0 Web Pages and Web ControlsGlobal.asax文件的作用ASP.NET應(yīng)用程序看起來(lái)是一個(gè)*. aspx文件中各自的網(wǎng)絡(luò)控制設(shè)置。雖然可以通過(guò)建立起來(lái)的相關(guān)網(wǎng)頁(yè)設(shè)置一個(gè)Web應(yīng)用程序,你很可能需要一種整個(gè)互動(dòng)的Web應(yīng)用程序。為此,ASP.NET Web應(yīng)用程序可以通過(guò)選擇一個(gè)可選的Global.asax網(wǎng)站添加新項(xiàng)菜單選項(xiàng)文件。簡(jiǎn)單地說(shuō),Global.asax是一種類似于傳統(tǒng)的double-clickable *.exe文件,在ASP.NET世界,這意味著這種類型的網(wǎng)站代表了本身運(yùn)行時(shí)的行為。一旦你插入的一個(gè)Global.asax文件轉(zhuǎn)換成一個(gè)網(wǎng)頁(yè)專題研究,你會(huì)發(fā)現(xiàn)它是包含一組事件處理器:void Application_Start(Object sender, EventArgs e)/ Code that runs on application startupvo
溫馨提示
- 1. 本站所有資源如無(wú)特殊說(shuō)明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁(yè)內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒(méi)有圖紙預(yù)覽就沒(méi)有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫(kù)網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。
最新文檔
- 教師師德師風(fēng)培訓(xùn)
- 四川省內(nèi)江市某校2024-2025學(xué)年高三上學(xué)期10月月考 化學(xué)試題(含答案)
- 內(nèi)蒙古通遼市科爾沁左翼中旗2024-2025學(xué)年九年級(jí)上學(xué)期期中考試數(shù)學(xué)試題
- 2024-2025學(xué)年遼寧省朝陽(yáng)市建平實(shí)驗(yàn)中學(xué)高二(上)月考數(shù)學(xué)試卷(10月份)(含答案)
- 初中數(shù)學(xué)《全等三角形》八大經(jīng)典模型含答案解析
- T-ZFDSA 26-2024 赤小豆排骨湯制作標(biāo)準(zhǔn)
- 面向SDG的國(guó)網(wǎng)行動(dòng)-持續(xù)推廣港口岸電 保護(hù)綠水青山
- 信息技術(shù)(第2版)(拓展模塊)教案 拓展模塊5 5.3常用核心技術(shù)1
- 2024-2025學(xué)年八年級(jí)上學(xué)期英語(yǔ)期中模擬試卷(譯林版+含答案解析)
- 一年級(jí)心理健康教案
- 癌癥篩查與早診培訓(xùn)考試試題及答案
- 安醫(yī)大生殖醫(yī)學(xué)課件10胚胎實(shí)驗(yàn)室的質(zhì)量控制與管理
- Unit 1 單元測(cè)讀后續(xù)寫(xiě) Mum and Her Bank Account課件-高中英語(yǔ)人教版(2019)必修第一冊(cè)
- 異地就醫(yī)在外居住證明
- 2023遼寧省交通高等??茖W(xué)校單招數(shù)學(xué)模擬試題(附答案解析)
- 最新版凈身出戶離婚協(xié)議書(shū)范本
- 路面標(biāo)線質(zhì)量檢驗(yàn)評(píng)定表
- 九種體質(zhì)課件
- 自行車小故事動(dòng)態(tài)圖中文版騎車小故事中文版
- 實(shí)驗(yàn)室間比對(duì)試驗(yàn)分析報(bào)告
- 處方書(shū)寫(xiě)規(guī)范-完美版課件
評(píng)論
0/150
提交評(píng)論