2023年全國碩士研究生考試考研英語一試題真題(含答案詳解+作文范文)_第1頁
已閱讀1頁,還剩12頁未讀, 繼續(xù)免費(fèi)閱讀

下載本文檔

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

文檔簡介

1、<p>  How to code with personalization and membership</p><p>  Summary: Learn how to reduce development time and how to code with personalization and membership in the upcoming version of ASP.NET, code

2、name ASP.NET "Whidbey". </p><p>  With both personalization and membership, the first step is configuring the provider that you will use to store the personalization or membership data. Though you

3、can create the Microsoft Access or Microsoft SQL Server? database and add the necessary configuration elements manually, the easier way is to use the ASP.NET Web Site Administration tool, shown in Figure 1. Note that to

4、configure an application successfully, you must be logged in using an account with administrator rights.</p><p>  The ASP.NET Web Site Administration tool provides the means to configure personalization and

5、membership features, as well as reports and data-access features.</p><p>  To create an Access .mdb file for storing personalization data, you need to open the Web Site Administration tool; the file, named A

6、spNetDB.mdb, will be created automatically in a folder named DATA. Although not enabled in the build of Visual Studio against which this article was written, the Web Site Administration.</p><p>  Now, will f

7、ound the member status database, and increases the essential disposition element to the web.config document. Here you need to do are only, according to need to establish the authorization on the page to limit as well as

8、to found register the page.</p><p>  Please note, has custom-made the database structure which for the personalization founds with the member status is the same, therefore may have custom-made same as the m

9、ember status use to the personalization provide the procedure, this point are very important. That is, if wants, you may have custom-made the use to the personalization differently to provide the procedure with the membe

10、r status, vice versa.</p><p>  Provide the procedure except built-in Access and SQL Server, you may also found your provide the procedure from the definition, and disposes your application procedure to use t

11、hese to provide the procedure. Therefore, if you already had the user proof database, and does not want to give up, ASP.NET may allow you to use this database and simultaneously to enjoy the advantage which the member st

12、atus service provides. Please note, when composes this article files, will found provides the procedure </p><p>  How does the data is save?</p><p>  How uses Server the Explorer examination dat

13、a to save in AspNetDB.mdb. Only need found one to the AspNetDB.mdb database connection, and drives the table from the connection to your stand page. Visual Studio will found GridView to control, and binds it to AccessDat

14、aSource controls. If you in time browsing application procedure page has the difficulty, please before glancing over the page closes the connection in Server Explorer.</p><p>  Had the enough theory basis, l

15、ets us watch a demonstration immediately. I will guide you to dispose the personalization to have custom-made with the member status use Access to provide the procedure; To member status database increase user; The incre

16、ase personalization has custom-made the attribute; And uses in page's on these attributes the anonymous user and has registered the user. starts your Visual the Studio transcription, and founds a new Web stand. After

17、 founding the stand and writes dow</p><p>  Then, single-clicks the Security option card, guaranteed that selects Security Setup Wizard to choose the button only, and single-clicks Next. First step only disp

18、layed information, therefore after reading, please single-click Next (possibly to need to roll can see button). In the second step, guaranteed that selects From the Internet to choose the button only, then single-clicks

19、Next. Please note, “From the Internet” the establishment will dispose the application procedure to use the ASP.NET wi</p><p>  Otherwise, only need fill in the essential field and single-click Next. The guid

20、e sixth step allows you to found the access rule, by acts according to the user either a role permission or the rejection visit to all or part application procedure. At present, only need single-click Next. You may momen

21、tarily increase the rule in later. Finally, single-clicks Finish to withdraw from the guide. The database already founded, and has the bioelement web.config document to increase to yours Web stand. Th</p><p>

22、;  <?xml version="1.0" encoding="utf-8"?><configuration><connectionStrings><add name="webAdminConnection631974613823397072"</p><p>  connectionString=&q

23、uot;c:\inetpub\wwwroot\aspnetPRO_PM\DATA\AspNetDB.mdb"</connectionStrings><system.web><membership defaultProvider="AspNetDB"><providers><add name="AspNetDB" type=

24、"System.Web.Security.AccessMembershipProvider,System.Web, Version=1.1.3300.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"connectionStringName="webAdminConnection631974613823397072"applicati

25、onName="/aspnetPRO_PM" enablePasswordRetrieval="true"enablePasswordReset="true" requiresQuestionAndAnswer="true"p</p><p>  The personalization has custom-made with

26、 the member status: What do they express?</p><p>  The personalization has custom-made with the member status enables you to control visit to your application procedure, as well as the memory concerns your a

27、pplication procedure user with the retrieval the information. You may act according to these information from the definition application procedure outward appearance and the behavior, even may permit the user when the a

28、nonymous browsing memory layout document information, and when they will later register with ease will migrate these informa</p><p>  The personalization will have custom-made allows you to concern your appl

29、ication procedure user's configuration files information storage in the durable data memory block. The personalization has custom-made the support to be possible to meet inserts the type data to provide the procedure

30、 level, as well as a group by strong type style memory and retrieval configuration files information API. The personalization has custom-made may let you assign one or many must save in the user configuration fi</p>

31、;<p>  個性化定制和成員身份的使用</p><p>  要使用個性化定制和成員身份,第一步是配置將用于存儲個性化定制或成員身份數(shù)據(jù)的提供程序。雖然您可以創(chuàng)建 Microsoft Access 或 Microsoft SQL Server數(shù)據(jù)庫并手動添加必要的配置元素,但更簡單的方法是使用 ASP.NET Web 站點(diǎn)管理工具。請注意,要成功配置應(yīng)用程序,您必須使用具有管理員權(quán)限的賬號登錄。AS

32、P.NET Web 站點(diǎn)管理工具提供了一些方法,用于配置個性化定制和成員身份功能以及報表和數(shù)據(jù)訪問功能。要創(chuàng)建用于存儲個性化數(shù)據(jù)的 Access.mdb 文件,您需要開啟 Web 站點(diǎn)管理工具;名為 AspNetDB.mdb 的文件將在名為 DATA 的文件夾中自動創(chuàng)建。盡管在本文針對的 Visual Studio 版本中未啟用,但 Web 站點(diǎn)管理工具包含一個完整的部分,專門用于配置個性化設(shè)置。在后面的小節(jié)中,我將一步步引導(dǎo)您手動添加

33、必要的配置部分。</p><p>  現(xiàn)在,將創(chuàng)建成員身份數(shù)據(jù)庫,并向 web.config 文件中添加必要的配置元素。此處您需要做的只是向數(shù)據(jù)庫添加用戶對個性化定制和成員身份使用相同的提供程序,這一點(diǎn)很重要。也就是說,如果愿意,您可以對個性化定制使用與成員身份不同的提供程序,反之亦然。</p><p>  除了內(nèi)置 Access 和 SQL Server 提供程序,您還可以創(chuàng)建自己的自定

34、義提供程序,并配置您的應(yīng)用程序以使用這些提供程序。因此,如果您已經(jīng)擁有用戶憑據(jù)數(shù)據(jù)庫且不想放棄,ASP.NET 可允許您使用該數(shù)據(jù)庫并同時享受成員身份服務(wù)提供的好處。請注意,在撰寫本文檔時,創(chuàng)建自定義提供程序的實(shí)際方法可能還會經(jīng)歷一些更改,因此我將為將來的文章保存一個創(chuàng)建自定義提供程序的演示。</p><p><b>  數(shù)據(jù)是如何存儲的?</b></p><p> 

35、 使用 Server Explorer 查看數(shù)據(jù)如何存儲在 AspNetDB.mdb 中。只需創(chuàng)建一個到 AspNetDB.mdb 的數(shù)據(jù)庫連接,并把表從連接拖動到您站點(diǎn)的頁面中。Visual Studio 將創(chuàng)建一個 GridView 控件,并將它綁定到 AccessDataSource 控件。如果您在瀏覽應(yīng)用程序中的頁面時有困難,請?jiān)跒g覽頁面之前于 Server Explorer 中關(guān)閉連接。</p><p>

36、;  有了足夠的理論依據(jù),讓我們馬上看一個示例。我將引導(dǎo)您配置個性化定制和成員身份以使用 Access 提供程序;向成員身份數(shù)據(jù)庫添加用戶;添加個性化定制屬性;并將頁面上的這些屬性用于匿名用戶和已登錄用戶。</p><p>  啟動您的 Visual Studio 副本,并創(chuàng)建一個新 Web 站點(diǎn)。創(chuàng)建站點(diǎn)并將該站點(diǎn)載入 IDE 后,單擊 Solution Explorer 窗口中的 Web Site Admin

37、istration tool 按鈕。</p><p>  然后,單擊 Security 選項(xiàng)卡,確保選中 Security Setup Wizard 單選按鈕,并單擊 Next。第一步僅顯示信息,因此閱讀之后請單擊 Next。在第二步中,確保選中 From the Internet 單選按鈕,然后單擊 Next。請注意,"From the Internet" 設(shè)置將配置應(yīng)用程序使用 ASP.N

38、ET 窗體身份驗(yàn)證,"From a local area network" 設(shè)置將配置應(yīng)用程序使用 Windows 身份驗(yàn)證。在第三步中,單擊 Next 以使用 Web 站點(diǎn)管理工具自動創(chuàng)建的 AspNetDB.mdb 文件。然后再次單擊 Next 跳過第四步。在第五步中,至少添加一個用戶用于測試目的。如果您想添加多個用戶,請?jiān)谔顚懲晁斜匦璧淖侄魏?,選中 Add Another User 復(fù)選框,然后單擊 Next

39、。否則,只需填寫必需的字段并單擊 Next。向?qū)У牡诹皆试S您創(chuàng)建訪問規(guī)則,以根據(jù)用戶或角色名允許或拒絕對所有或部分應(yīng)用程序的訪問。目前,只需單擊 Next。您可以在以后隨時添加規(guī)則。最后,單擊 Finish 以退出向?qū)?。?shù)據(jù)庫已經(jīng)創(chuàng)建,并且</p><p>  個性化定制和成員身份:它們表示什么?</p><p>  個性化定制和成員身份使您能夠控制對您應(yīng)用程序的訪問,以及存儲和檢索有關(guān)

40、您應(yīng)用程序用戶的信息。您可以根據(jù)這些信息自定義應(yīng)用程序的外觀和行為,甚至可以允許用戶在匿名瀏覽時存儲配置文件信息,并在他們以后登錄時輕松地將那些信息遷移到他們的個人配置文件中。</p><p>  個性化定制允許您將有關(guān)您應(yīng)用程序用戶的配置文件信息存儲在持久性數(shù)據(jù)存儲區(qū)中。個性化定制支持可接插式數(shù)據(jù)提供程序?qū)樱约耙唤M以強(qiáng)類型風(fēng)格存儲和檢索配置文件信息的 API。個性化定制可讓您指定一個或多個要存儲在用戶配置文件

41、中的任意屬性。您可以指定每個屬性的類型,以及是否跟蹤匿名用戶的屬性、該屬性是只讀還是可讀寫,等等。</p><p>  成員身份描述了一套技術(shù),包括用于存儲數(shù)據(jù)的后端提供程序、一組用于管理用戶和登錄的 API 以及一些控件等等。</p><p>  用戶憑據(jù)存儲在一個后端成員身份數(shù)據(jù)庫中,該數(shù)據(jù)庫由您在 Web.config 中配置的數(shù)據(jù)提供程序指定。ASP.NET Whidbey 配套帶

42、有 Access,并且 SQL Server 提供程序可以單獨(dú)使用。一旦配置了成員身份并向成員身份數(shù)據(jù)存儲區(qū)中添加了用戶,只需將單個控件拖到應(yīng)用程序的頁面上,即可為應(yīng)用程序添加登錄功能。ASP.NET 登錄控件包含驗(yàn)證憑據(jù)和執(zhí)行任何需要的重定向等所需的所有邏輯,并設(shè)計為與成員身份集成。</p><p>  為了說明個性化定制,接著我將為您演示如何添加一些屬性定義,以及如何從頁面存儲和檢索它們。其中一個屬性將允許用

43、戶選擇頁面主題,用戶在任何時候訪問該頁面時都將使用此主題。主題是 ASP.NET Whidbey 的一個新功能,它可讓您只用一個簡單的配置設(shè)置或幾行代碼就能修改整個站點(diǎn)的外觀和感覺。</p><p>  打開 Web.config 并將以下代碼直接添加到 <system.web> 元素的后面:</p><p>  <anonymousIdentification enab

44、led="true"/><personalization><profile><property name="Theme" allowAnonymous="true" /><property name="FavoriteColors"type="System.Collections.Spec

45、ialized.StringCollection"allowAnonymous="true" serializeAs="Xml" /></profile></personalization><anonymousIdentification> </p><p>  元素是允許匿名訪問任何個性化定制屬性所必需的。個性

46、化定制部分包含兩個屬性,這兩個屬性都使用 allowAnonymous 屬性來允許跟蹤未登錄用戶的屬性。第一個屬性 Theme 未指定類型,所以被視為字符串。第二個屬性 FavoriteColors 指定它的類型為 StringCollection 類。若嘗試將與 StringCollection 類不兼容的數(shù)據(jù)存儲在這個屬性中,將導(dǎo)致引發(fā)異常。serializeAs 屬性可讓 StringCollection 作為 XML 字符串存儲

47、在數(shù)據(jù)庫中。</p><p>  在項(xiàng)目中創(chuàng)建一個名為 Default.aspx 的新 Web 窗體。然后,切換到設(shè)計視圖并添加控件,并按指定方式設(shè)置它們的屬性。</p><p>  DropDownList ID = ThemesButton ID = SetTheme  Text = Set Theme TextBox ID =

48、textFavColor Button ID = AddColor Button Text = Add Color   Text = Add Color ListBox ID = listFavColors</p><p>  選擇 DropDownList 控件,并在屬性窗口中向下滾動以選擇 Items 屬性。單擊省略號按鈕,打開集合編輯器。添加兩項(xiàng),其

49、中一項(xiàng)的文本和值設(shè)置為 BasicBlue,另一項(xiàng)設(shè)置為 SmokeAndGlass,然后單擊 OK。雙擊 Set Theme 按鈕,并將以下代碼添加到事件處理程序中:</p><p>  Profile.Theme = Themes.SelectedValue將以下事件處理程序添加到服務(wù)器代碼窗口中:</p><p>  Sub Page_PreInit(ByVal sender As

50、 Object, _ByVal e As System.EventArgs)If Profile.Theme = "" ThenIf Request.Form("Themes") <>"" ThenPage.Theme = Request.Form("Themes")End IfElsePage.Theme = Profile.Th

溫馨提示

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

評論

0/150

提交評論