asp.net identity 2.2.0 在WebForm下的角色启用和基本使用(二)

时间:2022-12-10 22:59:01

管理用户功能:

界面部分:

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

<asp:Content ID="Content1" ContentPlaceHolderID="MainContent" Runat="Server">
<asp:HyperLink ID="HyperLink1" runat="server" NavigateUrl="~/admin/jueseadmin.aspx">角色管理</asp:HyperLink> <div>
<h1>用户管理</h1>
<div>
<h2>用户创建
</h2>
<asp:Panel ID="Panel2" runat="server">
<div>
<p>
用户创建
</p>
<div>
用户名称:<asp:TextBox ID="TextBoxRoleName" runat="server"></asp:TextBox>
<asp:Button ID="ButtonRolechuangjian" runat="server" Text="创建用户" ValidationGroup="cjth" />
<br />
<asp:Label ID="Labelcjts" runat="server"></asp:Label>
<asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="TextBoxRoleName" CssClass="text-warning" ErrorMessage="RequiredFieldValidator" ValidationGroup="cjjs">您未输入需创建的用户名称。</asp:RequiredFieldValidator>
</div>
</div>
</asp:Panel>
<hr />
<asp:Panel ID="Panel1" runat="server">
<div>
<p>
用户分配
</p>
<div>
用户名称:<asp:TextBox ID="yonghumingcheng" runat="server"></asp:TextBox>
用户名称:<asp:TextBox ID="juesemingcheng" runat="server"></asp:TextBox>
<asp:Button ID="Buttonjuesefenpei" runat="server" Text="划入用户" ValidationGroup="hrjs" />
<br />
<asp:Label ID="Labelhrts" runat="server"></asp:Label>
<asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ErrorMessage="RequiredFieldValidator" CssClass="text-warning" ControlToValidate="yonghumingcheng" ValidationGroup="hrjs">您未输入用户名称。</asp:RequiredFieldValidator>
<asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server" ErrorMessage="RequiredFieldValidator" CssClass="text-warning" ControlToValidate="juesemingcheng" ValidationGroup="hrjs">您未输入用户名称。</asp:RequiredFieldValidator>
</div>
</div>
</asp:Panel>
<hr />
<asp:Panel ID="Panel3" runat="server">
<div>
<p>
删除用户
</p>
<div>
用户名称:<asp:TextBox ID="TextBoxjueseshanchu" runat="server"></asp:TextBox>
<asp:Button ID="Buttonjueseshanchu" runat="server" Text="删除用户" ValidationGroup="scjs" />
<br />
<asp:Label ID="Labelscts" runat="server"></asp:Label>
<asp:RequiredFieldValidator ID="RequiredFieldValidator4" runat="server" ControlToValidate="TextBoxjueseshanchu" CssClass="text-warning" ErrorMessage="RequiredFieldValidator" ValidationGroup="scjs">您未输入需创建的用户名称。</asp:RequiredFieldValidator>
</div>
</div>
</asp:Panel>
</div>
</div>
</asp:Content>

cs文件内容:
^_^,我还没写呢。