Có 140+ tài liệu thuộc chủ đề "ASP.NET Configuration"
tailieu.vn Xem trực tuyến Tải xuống
This chapter was devoted to the ASP.NET Login controls. You learned how to create both a Login and Registration page.. You learned how to use the Login control to authenticate users and the CreateUserWizard control to register new users. You learned how to display either a Login or Logout link with the LoginStatus control. You learned how to display the...
tailieu.vn Xem trực tuyến Tải xuống
You can add a machineKey element with explicit keys to either the machine root web configuration file or to particular application web configuration files. If you don’t want to share the same keys across all the applications on a web server, you should add the machineKey element only to the applications that you need to share.. In the previous section,...
tailieu.vn Xem trực tuyến Tải xuống
ptg 1224 CHAPTER 27 Using ASP.NET Membership. The location element enables you to apply a set of authorization rules to a folder or page at a particular path.. In that case, you can use the location element to specify the path of the single page. The web configuration file in Listing 27.13 password-protects a page named Secret.aspx. LISTING 27.13 Web.Config...
tailieu.vn Xem trực tuyến Tải xuống
Make sure that you change the value of the decryptionKey attribute before using the web configuration file in Listing 27.19. You can generate a new decryptionKey with the GenerateKeys.aspx page described in the “Using Forms Authentication Across Applications” section, earlier in this chapter.. You can set three Membership provider attributes that determine password policy:. minRequiredPasswordLength —The minimum required password length....
tailieu.vn Xem trực tuyến Tải xuống
ptg 1244 CHAPTER 27 Using ASP.NET Membership. You must enable this attribute when using the Web Site Administration Tool.. attributeMapPasswordQuestion —Enables you to map the Membership security ques- tion to an Active Directory attribute.. attributeMapPasswordAnswer —Enables you to map the Membership security answer to an Active Directory attribute.. attributeMapFailedPasswordAnswerCount —Enables you to map the Membership MaxInvalidPasswordAttempts property to an Active...
tailieu.vn Xem trực tuyến Tải xuống
If you request the page in Listing 27.31 after enabling the WindowsTokenRoleProvider , you see the content displayed by the LoginView control only when you are a member of the Windows Administrators group.. Authorization Manager (AzMan) is a component of Windows Server 2003 and Windows Server 2008. You can use Authorization Manager to define roles, tasks, and operations.. Authorization Manager...
tailieu.vn Xem trực tuyến Tải xuống
ptg Finally, we examine a feature introduced with ASP.NET 2.0 the Profile object. When a web server creates a cookie, an additional HTTP header is sent to the browser when a page is served to the browser. This Set-Cookie header causes the browser to create a cookie named message that has the value Hello. After a cookie has been created...
tailieu.vn Xem trực tuyến Tải xuống
<html xmlns=”http://www.w3.org/1999/xhtml” >. <head id=”Head1” runat=”server”>. <title>Delete Cookie</title>. <form id=”form1” runat=”server”>. <asp:Label. id=”lblCookieName”. Text=”Cookie Name:”. Runat=”server” />. <asp:TextBox. id=”txtCookieName”. <asp:Button id=”btnDelete”. Text=”Delete Cookie”. In Listing 28.5, the expiration date is set to one day ago.. The page in Listing 28.6 deletes all cookies sent from the browser to the current domain (and path).. LISTING 28.6 DeleteAllCookies.aspx. Page Language=”C#” %>. “http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd”>....
tailieu.vn Xem trực tuyến Tải xuống
In Listing 28.11, a DataView object is stored in Session state. Using the Session Object. The main application programming interface for working with Session state is the HttpSessionState class. This means that you can access Session state from just about anywhere.. Count —Enables you to retrieve the number of items in Session state.. IsReadOnly —Enables you to determine whether the...
tailieu.vn Xem trực tuyến Tải xuống
Don’t use the web configuration file in Listing 28.16 without modifying the values of both the decryptionKey and validationKey attributes. You can use the GenerateKeys.aspx page discussed in Chapter 27, “Using ASP.NET Membership,” to generate new values for these attributes.. After you complete these configuration steps, Session state information is stored in the ASP.NET State Server automatically. You don’t need...
tailieu.vn Xem trực tuyến Tải xuống
ptg LISTING 28.23 Web.Config. <?xml version=”1.0”?>. <authentication mode=”Forms” />. <anonymousIdentification enabled=”true” />. name=”numberOfVisits”. allowAnonymous=”true” />. The numberOfVisits property defined in Listing 28.23 includes the allowAnonymous attribute. The web configuration file also enables Forms authentication. The page in Listing 28.24 illustrates how you modify a Profile property when Anonymous Identification is enabled.. LISTING 28.24 ShowAnonymousIdentification.aspx. Page Language=”C#” %>. “http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd”>. <script runat=”server”>....
tailieu.vn Xem trực tuyến Tải xuống
<asp:Button id=”btnAdd”. Runat=”server” OnClick=”btnAdd_Click” />. If you want to take control over how complex properties are stored, you can modify the value of the serializeAs attribute associated with a Profile property. For example, the results of serializing the ShoppingCart class with the XML Serializer are contained in Listing 28.31:. LISTING 28.31 Serialized Shopping Cart. <?xml version=”1.0” encoding=”utf-16”?>. <ShoppingCart xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance xmlns:xsd=”http://www.w3.org/2001/XMLSchema”>....
tailieu.vn Xem trực tuyến Tải xuống
LISTING 28.40 ManageProfiles.aspx. Page Language=”C#” %>. “http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd”>. <script runat=”server”>. lblProfiles.Text. lblInactiveProfiles.Text. FIGURE 28.10 Deleting inactive profiles.. lblResults.Text = String.Format(“{0} Profiles deleted. <html xmlns=”http://www.w3.org/1999/xhtml” >. <head id=”Head1” runat=”server”>. <form id=”form1” runat=”server”>. id=”lblProfiles”. Runat=”server” />. id=”lblInactiveProfiles”. <asp:Button id=”btnDelete”. Runat=”server” OnClick=”btnDelete_Click” />. id=”lblResults”. The page in Listing 28.40 displays the total number of profiles and the total number of inactive profiles. The web...
tailieu.vn Xem trực tuyến Tải xuống
Using Page Output Caching . T he slowest operation that you can perform in an ASP.NET page is database access. By taking advantage of caching, you can cache your data- base records in memory. Page Output Caching . Page Output Caching enables you to cache the entire rendered contents of a page in memory (everything that you see when you...
tailieu.vn Xem trực tuyến Tải xuống
<asp:Button id=”btnSelect”. Runat=”server” />. <asp:GridView id=”grdMovies”. <asp:SqlDataSource id=”srcCategories”. ConnectionString=”<. <asp:SqlDataSource id=”srcMovies”. Runat=”server”>. <asp:ControlParameter Name=”CategoryId”. ControlID=”dropCategories” />. </asp:SqlDataSource>. The page in Listing 29.4 contains an <. The ID of the DropDownList control is assigned to this parameter.. The VaryByControl attribute causes different cached versions of the page to be created whenever the DropDownList represents a different value.. Another option is to...
tailieu.vn Xem trực tuyến Tải xuống
DateTime.Now.ToString(“T”) %>. Runat=”server” />. ConnectionString=”<. <a href=”AddMovie.aspx”>Add Movie</a>. The page in Listing 29.12 contains a DetailsView control that enables you to add a new movie. Response.RemoveOutputCacheItem() method is called to remove the MovieList.aspx page from the cache. LISTING 29.12 AddMovie.aspx. Page Language=”C#” %>. “http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd”>. <script runat=”server”>. HttpResponse.RemoveOutputCacheItem(Page.ResolveUrl(“~/MovieList.aspx”));. Response.Redirect(“~/MovieList.aspx”);. <html xmlns=”http://www.w3.org/1999/xhtml” >. <head id=”Head1” runat=”server”>. <form id=”form1” runat=”server”>. Runat=”server” OnItemInserted=”dtlMovie_ItemInserted”>. HeaderText=”Title:”...
tailieu.vn Xem trực tuyến Tải xuống
ptg LISTING 29.19 ShowWriteSubstitution.aspx. Page Language=”C#” %>. OutputCache Duration=”15” VaryByParam=”none” %>. “http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd”>. <script runat=”server”>. <html xmlns=”http://www.w3.org/1999/xhtml” >. <head id=”Head1” runat=”server”>. <form id=”form1” runat=”server”>. DateTime.Now.ToString(“T”) %>. First, the method referenced by the WriteSubstitution() method does not have to be a method of the current class. The second advantage of the WriteSubstitution() method is that you can use it within a custom...
tailieu.vn Xem trực tuyến Tải xuống
LISTING 29.26 ShowDynamicUserControl.aspx. Page Language=”C#” %>. “http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd”>. <script runat=”server”>. (PartialCachingControl)Page.LoadControl(“Movies.ascx”);. FIGURE 29.10 Programmatically caching a User Control.. <html xmlns=”http://www.w3.org/1999/xhtml” >. <head id=”Head1” runat=”server”>. <title>Show Dynamic User Control</title>. <form id=”form1” runat=”server”>. id=”lblCacheDuration”. Runat=”server” />. <asp:PlaceHolder id=”PlaceHolder1”. In Listing 29.26, the default cache duration is modified by modifying the. You can refer to the User Control contained with an instance of the....
tailieu.vn Xem trực tuyến Tải xuống
LISTING 29.32 DataSourceKeyDependency.aspx. Page Language=”C#” %>. “http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd”>. <script runat=”server”>. <html xmlns=”http://www.w3.org/1999/xhtml” >. <head id=”Head1” runat=”server”>. <form id=”form1” runat=”server”>. Runat=”server” />. ConnectionString=”<. <a href=”AddMovieDataSourceKeyDependency.aspx”>Add Movie</a>. The SqlDataSource control in Listing 29.32 includes a CacheKeyDependency property that has the value MovieKey . This property creates a dependency between the DataSource control’s cached data and an item in the cache named MovieKey. The...
tailieu.vn Xem trực tuyến Tải xuống
<html xmlns=”http://www.w3.org/1999/xhtml” >. <head id=”Head1” runat=”server”>. <form id=”form1” runat=”server”>. Runat=”server” />. In Listing 29.37, when the DataSet is added to the cache with the Insert() method, its absoluteExpiration parameter is set to the value Cache.NoAbsoluteExpiration , and its slidingExpiration parameter is set to an interval of 5 minutes.. When you add an item to the Cache object, you can make...