外文翻譯aspnet概述_第1頁(yè)
外文翻譯aspnet概述_第2頁(yè)
外文翻譯aspnet概述_第3頁(yè)
外文翻譯aspnet概述_第4頁(yè)
外文翻譯aspnet概述_第5頁(yè)
已閱讀5頁(yè),還剩12頁(yè)未讀, 繼續(xù)免費(fèi)閱讀

下載本文檔

版權(quán)說(shuō)明:本文檔由用戶(hù)提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)

文檔簡(jiǎn)介

1、精選優(yōu)質(zhì)文檔-傾情為你奉上畢業(yè)設(shè)計(jì)(論文)外文資料翻譯題 目: 概述 院系名稱(chēng): 信息科學(xué)與工程學(xué)院 專(zhuān)業(yè)班級(jí): 計(jì)算機(jī)科學(xué)與技術(shù)05級(jí)6班 學(xué)生姓名: 學(xué) 號(hào): 指導(dǎo)教師: 教師職稱(chēng): 起止時(shí)間: 地 點(diǎn) 附 件: 1.外文資料翻譯譯文;2.外文原文。 指導(dǎo)教師評(píng)語(yǔ):外文資料的選擇與畢業(yè)設(shè)計(jì)內(nèi)容密切相關(guān),文章具有一定的難度,但譯文能夠較好的表達(dá)出原文的思想。專(zhuān)業(yè)術(shù)語(yǔ)運(yùn)用比較準(zhǔn)確,語(yǔ)句通順,文字?jǐn)?shù)量符合要求。不足之處在于個(gè)別語(yǔ)句的翻譯缺乏潤(rùn)色,有些牽強(qiáng)??傊?,譯文符合要求,反映出學(xué)生具有較好的專(zhuān)業(yè)外文閱讀和翻譯能力。 簽名: 2009年 3 月 2 日概述當(dāng)ASP第一次發(fā)布時(shí),Web編程還比較

2、困難,因?yàn)樾枰狪IS來(lái)處理ASP頁(yè)。后來(lái),和Visual Studio2005通過(guò)引入網(wǎng)站開(kāi)發(fā)模型使一切工作都變得容易了。借助該網(wǎng)站模型,您不必在Visual Studio 中創(chuàng)建新項(xiàng)目,而是可以指向一個(gè)目錄并開(kāi)始編寫(xiě)網(wǎng)頁(yè)和代碼。此外,您還可以使用內(nèi)置的 Development Server快速測(cè)試站點(diǎn), Development Server將寄宿在一個(gè)本地進(jìn)程中,并消除了必須安裝IIS才能進(jìn)行開(kāi)發(fā)這一先決條件。下面從不同的方面來(lái)介紹技術(shù)。類(lèi)庫(kù)是微軟.NET framework整體的一部分,它包含一組大量編程用的類(lèi),滿(mǎn)足各種編程需要。因?yàn)閂isual Basic、JScript和C+這些編程語(yǔ)

3、言的很多功能具有重疊性。舉例來(lái)說(shuō),對(duì)于每一種語(yǔ)言,你必須包括存取文件系統(tǒng)、與數(shù)據(jù)庫(kù)協(xié)同工作和操作字符串的方法。此外,這些語(yǔ)言包含相似的編程構(gòu)造。都能夠使用循環(huán)語(yǔ)句和條件語(yǔ)句。即使用Visual Basic寫(xiě)的條件語(yǔ)句的語(yǔ)法和用C+的不一樣,程序的功能也是相同的。對(duì)于多種語(yǔ)言來(lái)說(shuō)維持這一功能需要很大的工作量。那么對(duì)所有的語(yǔ)言創(chuàng)建這種功能一次,然后把這個(gè)功能用在每一種語(yǔ)言中豈不是更容易。然而.NET類(lèi)庫(kù)不完全是那樣。它含有大量的滿(mǎn)足編程需要的類(lèi)。舉例來(lái)說(shuō),.NET類(lèi)庫(kù)不僅包含處理數(shù)據(jù)庫(kù)訪問(wèn)的類(lèi)和文件協(xié)同工作,操作文本和生成圖像,而且還包含更多特殊的類(lèi)用在正則表達(dá)式和處理Web協(xié)議。此外.NET f

4、ramework,也包含支持所有的基本變量數(shù)據(jù)類(lèi)型的類(lèi),比如:字符串、整型、字節(jié)型、字符型和數(shù)組。.NET framework是龐大的。它包含數(shù)以千計(jì)的類(lèi)。(超過(guò)3,400)幸運(yùn)地是,類(lèi)不是簡(jiǎn)單的堆在一起。.NET framework的類(lèi)被組織成有層次結(jié)構(gòu)的命名空間。一個(gè)命名空間包含一組邏輯的類(lèi)。舉例來(lái)說(shuō),涉及到與文件系統(tǒng)協(xié)同工作的類(lèi)就集合在命名空間中。命名空間被組織成一個(gè)層次結(jié)構(gòu)(一棵邏輯樹(shù))。樹(shù)根就是SYSTEM命名空間。這個(gè)命名空間包含基本的數(shù)據(jù)類(lèi)型的所有的類(lèi),例如:字符串、數(shù)組,還包含提供隨機(jī)數(shù)字和日期的類(lèi)。你通過(guò)完整的類(lèi)的命名空間能唯一識(shí)別任何的類(lèi)在.NET framework中的位

5、置。例如,指定找到一個(gè)the File class類(lèi),按如下操作:.文件指命名空間,而文件指定特定的類(lèi)。在默認(rèn)情況下,在你的頁(yè)面中,類(lèi)被包含在一個(gè)選定的命名空間中這些默認(rèn)的命名空間使你在中最常用到的。System命名空間-包含所有的基本數(shù)據(jù)類(lèi)型和其他有用的類(lèi),例如:那些關(guān)于產(chǎn)生隨機(jī)數(shù)字和日期的類(lèi)。命名空間-包含的類(lèi)是標(biāo)準(zhǔn)的集合類(lèi),例如:哈希表,數(shù)組列表。命名空間-包含特殊的集合類(lèi),例如:連接列表和字符串集合。 命名空間-包括 files類(lèi)。命名空間-包含編碼,解碼和操作字符串內(nèi)容的類(lèi)。命名空間-包含的是匹配正則表達(dá)式和替代操作類(lèi)。 命名空間-工作在萬(wàn)維網(wǎng)方面包含的是瀏覽器請(qǐng)求和服務(wù)器響應(yīng)的類(lèi)。

6、命名空間-包含頁(yè)面緩沖內(nèi)容和自定義緩沖操作的類(lèi)。命名空間-包含執(zhí)行驗(yàn)證和授權(quán),例如:窗體和密碼驗(yàn)證的類(lèi)。命名空間-包含執(zhí)行保存狀態(tài)的類(lèi)。命名空間-包含構(gòu)建頁(yè)面的用戶(hù)接口的類(lèi)。命名空間-包含HTML控件的類(lèi)。命名空間-包含Web控件的類(lèi)。.Net支持C#,C+和Visual Basic中的任一種語(yǔ)言作為你的編程語(yǔ)言來(lái)完成程序編寫(xiě)。但不管你使用什么語(yǔ)言開(kāi)發(fā)頁(yè)面,你需要明白在執(zhí)行前必須編譯,這就意味著執(zhí)行速度非??臁5谝淮握?qǐng)求頁(yè)面,頁(yè)面被編譯成一個(gè).NET類(lèi),這個(gè)類(lèi)文件被保存在一個(gè)特殊的目錄下,這個(gè)目錄的名字叫Temporary Files。對(duì)于一個(gè)頁(yè)面一個(gè)通信類(lèi)文件也會(huì)出現(xiàn)在Temporary F

7、iles目錄下。以后不管任何時(shí)候你請(qǐng)求那個(gè)同樣的頁(yè)面,那個(gè)通信類(lèi)文件就會(huì)執(zhí)行。當(dāng)頁(yè)面被編譯的時(shí)候,它沒(méi)被直接地被編譯成機(jī)器碼而是被編譯成了一個(gè)中間語(yǔ)言,名字叫MSIL,所有.NET可用的語(yǔ)言都被編譯成這種中間語(yǔ)言。一個(gè)頁(yè)面不會(huì)被編譯成本地機(jī)器碼直到它被一個(gè)瀏覽器訪問(wèn),在那個(gè)時(shí)間點(diǎn)包含在Temporary Files目錄下的類(lèi)文件用JIT編譯器編譯并且執(zhí)行。這些迷惑的方面體現(xiàn)在整個(gè)過(guò)程中且都在后臺(tái)運(yùn)行,你必須要做的是用資源代碼為你的頁(yè)面創(chuàng)建一個(gè)文本文件。2.用Web服務(wù)器控件創(chuàng)建窗體用幾個(gè)基本W(wǎng)eb控件來(lái)代替標(biāo)準(zhǔn)的HTML窗體元素,例如radiobuttons、textboxes, and li

8、stboxes.在Web應(yīng)用程序中可以用這些控件創(chuàng)建用戶(hù)界面。 3.用驗(yàn)證控件做頁(yè)面驗(yàn)證傳統(tǒng)地,當(dāng)增加驗(yàn)證到頁(yè)面中時(shí),會(huì)面臨一個(gè)嚴(yán)峻的選擇。你可以添加窗體頁(yè)面驗(yàn)證規(guī)則到你的服務(wù)器端代碼,也可以添加驗(yàn)證規(guī)則到你的客戶(hù)端代碼。寫(xiě)驗(yàn)證代碼到客戶(hù)端代碼中的優(yōu)勢(shì)能夠及時(shí)反饋到你的用戶(hù)。例如,一個(gè)使用者忽略輸入一個(gè)要求檢驗(yàn)的字段,你能夠及時(shí)的顯示一個(gè)錯(cuò)誤信息而不需要返回到服務(wù)器端解決。人們喜歡客戶(hù)端的驗(yàn)證。它能產(chǎn)生一種很好的效果。然而,問(wèn)題是它不與所有的瀏覽器兼容。不是所有的瀏覽器支持JavaScript、不同版本的瀏覽器的不同版本支持JavaScript,所以客戶(hù)端驗(yàn)證沒(méi)有保障。由于這個(gè)原因,許多開(kāi)發(fā)者

9、決定添加自定義驗(yàn)證到服務(wù)器端。因?yàn)榉?wù)器端代碼能夠和任何瀏覽器協(xié)同工作。這樣的做法是更有安全保障。同時(shí)這些驗(yàn)證控件會(huì)自動(dòng)地產(chǎn)生客戶(hù)端代碼和服務(wù)器端代碼。如果一個(gè)瀏覽器有能力支持JavaScript,客戶(hù)端的驗(yàn)證腳本將會(huì)自動(dòng)返回到瀏覽器。如果一個(gè)瀏覽器不支持JavaScript,那個(gè)驗(yàn)證規(guī)則會(huì)自動(dòng)在服務(wù)器端代碼中執(zhí)行。控制字段:RequiredFieldValidator控件你可以用這個(gè)控件來(lái)檢查在一個(gè)Web窗體中是否為空,典型地,你和TextBox控件一起使用這個(gè)控件。然而,這個(gè)控件也可以和其他的輸入型控件結(jié)合使用,例如:RadioButtonList控件。驗(yàn)證表達(dá)式:RegularExpre

10、ssionValidator控件你能使用RegularExpressionValidator控件來(lái)驗(yàn)證輸入的值是否和定義的正則表達(dá)式相匹配。例如:你能使用這控件來(lái)檢查一個(gè)用戶(hù)是否輸入一個(gè)合法的電子郵件地址,電話號(hào)碼,用戶(hù)名或密碼。比較值:CompareValidator控件這個(gè)CompareValidator 控件用于比較一個(gè)輸入的數(shù)據(jù)和另外一個(gè)值是否相同。另外一個(gè)值可能是固定值,例如:一個(gè)特定的數(shù)字或者是輸入到另一個(gè)控件中的一個(gè)值??偨Y(jié)錯(cuò)誤:ValidationSummary控件假想一個(gè)頁(yè)面有50個(gè)字段假如你僅僅用上部分討論的那些驗(yàn)證控件來(lái)顯示錯(cuò)誤看見(jiàn)一個(gè)錯(cuò)誤在頁(yè)面中將是很難的。例如:你可能

11、需要滾動(dòng)到第48個(gè)頁(yè)面字段來(lái)找到這個(gè)錯(cuò)誤信息。幸好,微軟除了包含上面提到的控件還包括ValidationSummary控件。你能用這個(gè)控件綜合所有的錯(cuò)誤信息在一個(gè)頁(yè)面的上端或者你想要的任何一個(gè)地方。4.先進(jìn)的控件編程保存瀏覽狀態(tài)默認(rèn)地,幾乎所有的控件都會(huì)在先前的窗體中保留他們的屬性值。舉例來(lái)說(shuō),如果你輸入文本到一個(gè)Lebel標(biāo)簽上然后提交那個(gè)頁(yè)面,當(dāng)那個(gè)頁(yè)面再次被訪問(wèn)時(shí)那個(gè)Lebel標(biāo)簽的內(nèi)容將會(huì)被保存下來(lái)。瀏覽狀態(tài)的妙處是它不依賴(lài)任何的特定服務(wù)器或?yàn)g覽器的屬性。尤其,它不依賴(lài)cookies,session變量、或應(yīng)用程序變量。瀏覽狀態(tài)在一個(gè)名叫做VIEWSTATE的隱藏頁(yè)面中執(zhí)行,這個(gè)隱藏頁(yè)

12、面自動(dòng)創(chuàng)建每個(gè)Web窗體。當(dāng)應(yīng)用時(shí),瀏覽狀態(tài)能夠在你的網(wǎng)站中產(chǎn)生藝術(shù)性的積極效果,例如:你在一個(gè)支持瀏覽狀態(tài)的控件中顯示數(shù)據(jù)庫(kù)數(shù)據(jù),你不需要每次都返回到需要反饋到服務(wù)器的數(shù)據(jù)庫(kù)頁(yè)面。它能夠自動(dòng)地保存頁(yè)面里的數(shù)據(jù)狀態(tài)。顯示和隱藏內(nèi)容假想把一個(gè)form變成很多頁(yè)面,以便一個(gè)人每次只看那個(gè)form的一個(gè)部分。可以設(shè)置單個(gè)控件和一組控件的Visible and Enabled屬性來(lái)隱藏和顯示頁(yè)面內(nèi)容。使用Visible and Enabled屬性每個(gè)控件,包括HTML和Web控件,有一個(gè)Visible 屬性來(lái)決定那個(gè)控件是否可見(jiàn)。 當(dāng)一個(gè)控件的Visible是false值,那個(gè)控件就不會(huì)在頁(yè)面上顯示;

13、那個(gè)控件也不會(huì)進(jìn)一步運(yùn)行。Web控件(不是每個(gè)HTML控件)還有一個(gè)叫Enabled的屬性。當(dāng)Enabled的屬性是false值,你用的瀏覽器是或更高的版本那個(gè)控件被封住了,也不起作用了,當(dāng)用其他的瀏覽器的時(shí)候,如:網(wǎng)景瀏覽器那個(gè)控件不會(huì)被封,但它也是不起作用的。部署項(xiàng)目的魅力在于您在開(kāi)發(fā)Web應(yīng)用程序時(shí)無(wú)需考慮打包和部署。當(dāng)需要其他類(lèi)時(shí)可向App_Code目錄添加一個(gè).cs文件即可開(kāi)始編寫(xiě)。當(dāng)希望將可本地化的字符串存儲(chǔ)在資源文件中時(shí),可向App_GlobalResources目錄添加一個(gè).resx文件并鍵入字符串。一切都順順當(dāng)當(dāng),根本就不必考慮編譯和部署方面的事情。在準(zhǔn)備進(jìn)行部署時(shí),有多種可

14、選方案。最簡(jiǎn)單的方案是將文件復(fù)制到主運(yùn)行服務(wù)器并按要求編譯每一個(gè)文件(和在測(cè)試環(huán)境中一樣)。第二種方案是使用實(shí)用工具將應(yīng)用程序預(yù)編譯為二進(jìn)制版本,之后將只剩下要放到服務(wù)器上的一組程序集、靜態(tài)內(nèi)容和配置文件。第三種方案也使用,但要?jiǎng)?chuàng)建一個(gè)可更新的二進(jìn)制部署,其中.as*x文件保持不變(并且可修改),而所有代碼文件都編譯為二進(jìn)制程序集。6. C#語(yǔ)言C# 是一種簡(jiǎn)潔、類(lèi)型安全的面向?qū)ο蟮恼Z(yǔ)言,開(kāi)發(fā)人員可以使用它來(lái)構(gòu)建在 .NET Framework 上運(yùn)行的各種安全、可靠的應(yīng)用程序。使用 C#,您可以創(chuàng)建傳統(tǒng)的 Windows 客戶(hù)端應(yīng)用程序、XML Web services、分布式組件、客戶(hù)端

15、- 服務(wù)器應(yīng)用程序、數(shù)據(jù)庫(kù)應(yīng)用程序以及很多其他類(lèi)型的程序。Microsoft Visual C# 2005 提供高級(jí)代碼編輯器、方便的用戶(hù)界面設(shè)計(jì)器、集成調(diào)試器和許多其他工具,以在 C# 語(yǔ)言版本 和 .NET Framework 的基礎(chǔ)上加快應(yīng)用程序的開(kāi)發(fā)。C# 語(yǔ)法表現(xiàn)力強(qiáng),只有不到 90 個(gè)關(guān)鍵字,而且簡(jiǎn)單易學(xué)。C# 的大括號(hào)語(yǔ)法使任何熟悉 C、C+ 或 Java 的人都可以立即上手。了解上述任何一種語(yǔ)言的開(kāi)發(fā)人員通常在很短的時(shí)間內(nèi)就可以開(kāi)始使用 C# 高效地工作。C# 語(yǔ)法簡(jiǎn)化了 C+ 的諸多復(fù)雜性,同時(shí)提供了很多強(qiáng)大的功能,例如可為空的值類(lèi)型、枚舉、委托、匿名方法和直接內(nèi)存訪問(wèn),這些

16、都是 Java 所不具備的。C# 還支持泛型方法和類(lèi)型,從而提供了更出色的類(lèi)型安全和性能。C# 還提供了迭代器,允許集合類(lèi)的實(shí)現(xiàn)者定義自定義的迭代行為,簡(jiǎn)化了客戶(hù)端代碼對(duì)它的使用。作為一種面向?qū)ο蟮恼Z(yǔ)言,C# 支持封裝、繼承和多態(tài)性概念。所有的變量和方法,包括 Main 方法(應(yīng)用程序的入口點(diǎn)),都封裝在類(lèi)定義中。類(lèi)可能直接從一個(gè)父類(lèi)繼承,但它可以實(shí)現(xiàn)任意數(shù)量的接口。重寫(xiě)父類(lèi)中的虛方法的各種方法要求 override 關(guān)鍵字作為一種避免意外重定義的方式。在 C# 中,結(jié)構(gòu)類(lèi)似于一個(gè)輕量類(lèi);它是一種堆棧分配的類(lèi)型,可以實(shí)現(xiàn)接口,但不支持繼承。除了這些基本的面向?qū)ο蟮脑恚珻# 還通過(guò)幾種創(chuàng)新的語(yǔ)

17、言結(jié)構(gòu)加快了軟件組件的開(kāi)發(fā),其中包括: 封裝的方法簽名(稱(chēng)為委托),它實(shí)現(xiàn)了類(lèi)型安全的事件通知。 屬性 (Property),充當(dāng)私有成員變量的訪問(wèn)器。 屬性 (Attribute),提供關(guān)于運(yùn)行時(shí)類(lèi)型的聲明性元數(shù)據(jù)。 內(nèi)聯(lián) XML 文檔注釋。在 C# 中,如果需要與其他 Windows 軟件(如 COM 對(duì)象或本機(jī) Win32 DLL)交互,可以通過(guò)一個(gè)稱(chēng)為“Interop”的過(guò)程來(lái)實(shí)現(xiàn)。互操作使 C# 程序能夠完成本機(jī) C+ 應(yīng)用程序可以完成的幾乎任何任務(wù)。在直接內(nèi)存訪問(wèn)必不可少的情況下,C# 甚至支持指針和“不安全”代碼的概念。C# 的生成過(guò)程比 C 和 C+ 簡(jiǎn)單,比 Java 更為靈

18、活。沒(méi)有單獨(dú)的頭文件,也不要求按照特定順序聲明方法和類(lèi)型。C# 源文件可以定義任意數(shù)量的類(lèi)、結(jié)構(gòu)、接口和事件。C# 程序在 .NET Framework 上運(yùn)行,它是 Windows 的一個(gè)必要組件,包括一個(gè)稱(chēng)為公共語(yǔ)言運(yùn)行時(shí) (CLR) 的虛擬執(zhí)行系統(tǒng)和一組統(tǒng)一的類(lèi)庫(kù)。CLR 是 Microsoft 的公共語(yǔ)言基礎(chǔ)結(jié)構(gòu) (CLI) 的一個(gè)商業(yè)實(shí)現(xiàn)。CLI 是一種國(guó)際標(biāo)準(zhǔn),是用于創(chuàng)建語(yǔ)言和庫(kù)在其中無(wú)縫協(xié)同工作的執(zhí)行和開(kāi)發(fā)環(huán)境的基礎(chǔ)。用 C# 編寫(xiě)的源代碼被編譯為一種符合 CLI 規(guī)范的中間語(yǔ)言 (IL)。IL 代碼與資源(如位圖和字符串)一起作為一種稱(chēng)為程序集的可執(zhí)行文件存儲(chǔ)在磁盤(pán)上,通常具有

19、的擴(kuò)展名為 .exe 或 .dll。程序集包含清單,它提供關(guān)于程序集的類(lèi)型、版本、區(qū)域性和安全要求等信息。執(zhí)行 C# 程序時(shí),程序集將加載到 CLR 中,這可能會(huì)根據(jù)清單中的信息執(zhí)行不同的操作。然后,如果符合安全要求,CLR 執(zhí)行實(shí)時(shí) (JIT) 編譯以將 IL 代碼轉(zhuǎn)換為本機(jī)機(jī)器指令。CLR 還提供與自動(dòng)垃圾回收、異常處理和資源管理有關(guān)的其他服務(wù)。由 CLR 執(zhí)行的代碼有時(shí)稱(chēng)為“托管代碼”,它與編譯為面向特定系統(tǒng)的本機(jī)機(jī)器語(yǔ)言的“非托管代碼”相對(duì)應(yīng)。下圖演示了 C# 源代碼文件、基類(lèi)庫(kù)、程序集和 CLR 的編譯時(shí)與運(yùn)行時(shí)的關(guān)系。語(yǔ)言互操作性是 .NET Framework 的一個(gè)關(guān)鍵功能。因

20、為由 C# 編譯器生成的 IL 代碼符合公共類(lèi)型規(guī)范 (CTS),因此從 C# 生成的 IL 代碼可以與從 Visual Basic、Visual C+、Visual J# 的 .NET 版本或者其他 20 多種符合 CTS 的語(yǔ)言中的任何一種生成的代碼進(jìn)行交互。單一程序集可能包含用不同 .NET 語(yǔ)言編寫(xiě)的多個(gè)模塊,并且類(lèi)型可以相互引用,就像它們是用同一種語(yǔ)言編寫(xiě)的。除了運(yùn)行時(shí)服務(wù),.NET Framework 還包含一個(gè)由 4000 多個(gè)類(lèi)組成的內(nèi)容詳盡的庫(kù),這些類(lèi)被組織為命名空間,為從文件輸入和輸出到字符串操作、到 XML 分析、到 Windows 窗體控件的所有內(nèi)容提供多種有用的功能。

21、典型的 C# 應(yīng)用程序使用 .NET Framework 類(lèi)庫(kù)廣泛地處理常見(jiàn)的“日?!比蝿?wù)。 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. 本站所有資源如無(wú)特殊說(shuō)明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶(hù)所有。
  • 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ì)用戶(hù)上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶(hù)上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶(hù)因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。

最新文檔

評(píng)論

0/150

提交評(píng)論