Đang chuẩn bị nút TẢI XUỐNG, xin hãy chờ
Tải xuống
Trong khi vòng điều kiện báo cáo báo cáo vòng Trong khi điều kiện Cho đến khi báo cáo tình trạng vòng báo cáo vòng Cho đến khi điều kiện Thứ ba kiểm soát người dùng của chúng tôi cũng là một nhà cung cấp dữ liệu. | Enabling Anonymous User Profiles 719 such as System.Int32 System.DateTime System.Collection. Specialized.StringCollection or even a custom type you create in your code. serializeAs This specifies the serialization formatter for the property. The default is string. Generating the database At this point you ve defined the properties that you want to track but you don t have anywhere to hold the data once you get it. There s a big empty space inside your site s App_Data folder where the data file should be. If you re impatient like me you want to see some action and maybe a little ASP.NET magic. 1. Add a page called create.aspx to your project. 2. Insert the following code as the handler for the Load event Protected Sub Page_Load _ ByVal sender As Object _ ByVal e As System.EventArgs Profile.Language en-US End Sub 3. Save and run the page. 4. In Solution Explorer refresh the view and look in the App_Data folder. 5. Be amazed to find a new file called ASPNETDB.MDF. All the preceding code does is assign a value to the Language property that we created inside the web.config file. ASP.NET determines that we ve implemented profiles for our site and therefore generates a database. While we re sidetracked let s look closer at the profile database. Exploring the profile database So far we ve executed one statement and created a whole database. There s already some data to explore. To do so 1. Open Database Explorer View1 Database Explorer . 2. Expand the Data Connections node to show the ASPNETDB.MDF connection. 3. Expand the Tables node as shown in Figure 2-2. Book VIII 2 Using Profiles 720 Enabling Anonymous User Profiles Figure 2-2 Examining ASPNETDB. MDF. 4. Right-click aspnet_Profile and from the context menu click Show Table Data. As shown in Figure 2-3 a window opens to reveal a single database record. Figure 2-3 A single database record. The record is the profile for the anonymous user who browsed to the create.aspx page. Let s analyze the fields and stored values in