成员资格管理验证

母版页:

<%@ Master Language="C#" AutoEventWireup="true" CodeFile="MasterPage.master.cs" Inherits="MasterPage" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <link href="Css/muban.css" rel="stylesheet" type="text/css" />
    <asp:ContentPlaceHolder id="head" runat="server">
    </asp:ContentPlaceHolder>
</head>
<body>
    <form id="form1" runat="server">
    <div class="header"></div>
    <div class="zhong">
    <div class="left">
        <asp:ContentPlaceHolder id="ContentPlaceHolder1" runat="server">
       
        </asp:ContentPlaceHolder>
    </div>
    <div class="right"></div>
    </div>
    <div class="footer"></div>
    </form>
</body>
</html>

登陆页面:

<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="UserLogin.aspx.cs" Inherits="UserLogin" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
    <asp:Login ID="Login1" runat="server" BorderColor="#FFFF99"
    DestinationPageUrl="~/Manager/RolesManager.aspx" Height="445px" Width="343px">
</asp:Login>
</asp:Content>

 注册页面:

<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="zhuce.aspx.cs" Inherits="zhuce" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
    <asp:CreateUserWizard ID="CreateUserWizard1" runat="server" BackColor="#FFFBD6"
    BorderColor="#FFDFAD" BorderStyle="Solid" BorderWidth="1px"
    Font-Names="Verdana" Font-Size="0.8em" Height="449px" Width="344px">
    <ContinueButtonStyle BackColor="White" BorderColor="#CC9966"
        BorderStyle="Solid" BorderWidth="1px" Font-Names="Verdana"
        ForeColor="#990000" />
    <CreateUserButtonStyle BackColor="White" BorderColor="#CC9966"
        BorderStyle="Solid" BorderWidth="1px" Font-Names="Verdana"
        ForeColor="#990000" />
    <TitleTextStyle BackColor="#990000" Font-Bold="True" ForeColor="White" />
    <WizardSteps>
        <asp:CreateUserWizardStep runat="server" />
        <asp:CompleteWizardStep runat="server" />
    </WizardSteps>
    <HeaderStyle BackColor="#FFCC66" BorderColor="#FFFBD6" BorderStyle="Solid"
        BorderWidth="2px" Font-Bold="True" Font-Size="0.9em" ForeColor="#333333"
        HorizontalAlign="Center" />
    <NavigationButtonStyle BackColor="White" BorderColor="#CC9966"
        BorderStyle="Solid" BorderWidth="1px" Font-Names="Verdana"
        ForeColor="#990000" />
    <SideBarButtonStyle ForeColor="White" />
    <SideBarStyle BackColor="#990000" Font-Size="0.9em" VerticalAlign="Top" />
</asp:CreateUserWizard>
</asp:Content>

 删除用户:

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="UserManager.aspx.cs" Inherits="Manager_UserManager" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
   
    &nbsp;<asp:Label ID="Label1" runat="server" Text="用户名:"></asp:Label>
        <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
        <br />
        <br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        <asp:Button ID="btn_Search" runat="server" οnclick="btn_Search_Click"
            Text="删  除" />
&nbsp;
        <asp:Button ID="Button1" runat="server" οnclick="Button1_Click" Text="取  消" />
        <br />
        <asp:GridView ID="GridView1" runat="server">
        </asp:GridView>
   
    </div>
    </form>
</body>
</html>

 

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.Security;

public partial class Manager_UserManager : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        this.GridView1.DataSource = Membership.GetAllUsers();
        this.GridView1.DataBind();
    }
    protected void btn_Search_Click(object sender, EventArgs e)
    {
        Membership.DeleteUser(this.TextBox1.Text);
        Response.Write("删除用户成功!");
    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        Response.Redirect("~/UserLogin.aspx");
    }
}

 

添加和删除角色:

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="RolesManager.aspx.cs" Inherits="Manager_RolesManager" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
   
        <asp:Label ID="Label1" runat="server" Text="添加角色:"></asp:Label>
        <asp:TextBox ID="AddRoles" runat="server"></asp:TextBox>
        <asp:Button ID="btn_Add" runat="server" οnclick="btn_Add_Click" Text="添  加" />
        <br />
        <asp:Label ID="Label2" runat="server" Text="删除角色:"></asp:Label>
        <asp:TextBox ID="DeleteRoles" runat="server"></asp:TextBox>
        <asp:Button ID="btn_delete" runat="server" οnclick="btn_delete_Click"
            Text="删  除" />
        <br />
        <asp:ListBox ID="ListBox1" runat="server" Height="68px" Width="286px">
        </asp:ListBox>
   
    </div>
    </form>
</body>
</html>

 

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.Security;

public partial class Manager_RolesManager : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            string[] role = Roles.GetAllRoles();
            foreach (string str in role)
            {
                this.ListBox1.Items.Add(str);
            }
        }
    }
    protected void btn_Add_Click(object sender, EventArgs e)
    {
        Roles.CreateRole(this.AddRoles.Text);
        this.ListBox1.Items.Add(this.AddRoles.Text);
    }
    protected void btn_delete_Click(object sender, EventArgs e)
    {
        Roles.DeleteRole(this.DeleteRoles.Text);
        this.ListBox1.Items.Remove(this.DeleteRoles.Text);
    }
}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值