tailieunhanh - Professional ASP.NET 3.5 in C# and Visual Basic Part 71
Professional in C# and Visual Basic Part 71. Building on the revolutionary release, adds several key new developer features including AJAX, LINQ, and a new CSS designer in Visual Web Developer 2008. The dramatic reduction in code that developers realized from the more than 50 new server controls in now allows developers the time to make their applications more interactive with AJAX, to work with data in their preferred language with LINQ, and to build visually attractive and consistent standards-based sites with CSS. . | Chapter 13 Extending the Provider Model roleManager defaultProvider LimitedProvider enabled true providers add connectionStringName LocalSqlServer applicationName name LimitedProvider type LimitedSqlRoleProvider providers roleManager configuration Remember that you have to define the provider to use in your application by providing a value for the defaultprovider attribute and defining that provider further in the provider section. You also have to enable the provider by setting the enabled attribute to true. By default the role management system is disabled. Using the add element you can add a provider instance that makes use of the LimitedSqlRole-Provider class. Because this provider derives from the SqlRoleProvider class you must use some of the same attributes that this provider requires such as the connectionStringName attribute that points to the connection string to use to connect to the specified SQL instance. After you have the new LimitedSqlRoleProvider instance in place and defined in the file you can use the Roles class in your application just as you normally would but notice the behavior of this class is rather different from the normal SqlRoleProvider. To see it in action construct a simple page that includes a TextBox Button and Label server control. The page should appear as shown in Listing 13-23. Listing 13-23 Using VB @ Page Language VB script runat server Protected Sub Button1_Click ByVal sender As Object _ ByVal e As Try Role successfully created. Catch ex As Exception End Try End Sub script html xmlns http 1999 xhtml head runat server title Main Page title head body form id form1 runat server div Continued 657 Chapter 13 Extending the Provider Model Role Name br asp TextBox ID TextBox1 runat server asp TextBox br br asp Button ID Button1 runat server Text Create Role OnClick Button1_Click br br
đang nạp các trang xem trước