roo

programmer的人生才刚刚开始……

导航

asp.net笔记(一)

1. Master Page & Theme Skin
 1) Master Page
 file: *.master
 code: <%@ Master Language="C#" AutoEventWireup="true" CodeFile="MasterPage.master.cs" Inherits="MasterPage" %>
 codebeside: public partial class MasterPage : System.Web.UI.MasterPage
 
 file: *.aspx
 code: <%@ Page Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="Default2.aspx.cs" Inherits="Default2" Title="Untitled Page" %>
 codebeside: public partial class Default2 : System.Web.UI.Page
 
 2) Style & CSS
 sample1:
  <P1 style="color: blue"></P1>
  <asp:Label ID="Label1" runat="server" Style="font-size: 20px; color: black"></asp:Label>
 sample2:
  <head runat="server"><style>.buttonstyle{ background-color: lime;} </style></head>
  <asp:Button ID="Button1" class="buttonstyle" runat="server" Text="Button" />
  
 3) Theme Skin
 folder: App_Themes/*
  file: *.css
  code: ...
  file: *.skin
  code: <asp:Image runat="server" [SkinId="image1"] ImageUrl="~/images/image1.jpg" />
 
 file: *.aspx
 code:
  <%@ Page Language="C#" Theme="SkinFile" %>
  <%@ Page Language="C#" StylesheetTheme="SkinFile" %>
  
  <asp:Image runat="server" [SkinId="image1"] />
  
2. Membership and Role Manager
 1) Authentication
 two ways:
  (1) acls--authorization by user account ( deployed in IIS ) ;
  (2) URL--authorization by ASP.NET configure file ( None, Windows, Forms, Passport )
 
 example for (2):
  file: Web.Config
   <configuration>
    <system.web>
     <authentication mode="Forms" > <forms loginUrl="login.aspx" /> </authentication>
     <roleManager enable="true" > <providers /> <roleManage>
     <membership > <providers /> </membership>    
    </system.web>
    <location path="Admin">
     <system.web>
      <authorization> <allow roles="admin"/> <deny users="*"/></authorization>
     </system.web>
    </location>
   </configuration>

 2) Authentication Controls
 3) operation layer: class Membership, class Roles

posted on 2007-07-22 13:47  roo  阅读(172)  评论(0)    收藏  举报