首页 > 编程 > .NET > 正文

asp.net里面的身份验证和授权

2024-07-10 13:12:34
字体:
来源:转载
供稿:网友

今天闲着无聊.想起来了asp.net身份验证.感觉良好.贴出下列代码:
login.aspx html代码


<%@ page language="c#" codebehind="02login.aspx.cs" autoeventwireup="false" inherits="身份验证._02login" %>
<!doctype html public "-//w3c//dtd html 4.0 transitional//en" >
<html>
    <head>
        <title>02login</title>
        <meta name="generator" content="microsoft visual studio .net 7.1">
        <meta name="code_language" content="c#">
        <meta name="vs_defaultclientscript" content="javascript">
        <meta name="vs_targetschema" content="http://schemas.microsoft.com/intellisense/ie5">
    </head>
    <body ms_positioning="gridlayout">
        <form id="form1" method="post" runat="server">
            <font face="宋体">
                <table id="table1" style="z-index: 102; left: 152px; width: 446px; position: absolute; top: 80px; height: 72px"
                    cellspacing="1" cellpadding="1" width="446" border="1">
                    <tr>
                        <td>
                            <asp:label id="label1" runat="server">用户名称:</asp:label></td>
                        <td>
                            <asp:textbox id="tbname" runat="server" width="183px"></asp:textbox></td>
                        <td>
                            <asp:requiredfieldvalidator id="requiredfieldvalidator1" runat="server" errormessage="用户名不能为空!" controltovalidate="tbname"></asp:requiredfieldvalidator></td>
                    </tr>
                    <tr>
                        <td>
                            <asp:label id="label2" runat="server">密码:</asp:label></td>
                        <td>
                            <asp:textbox id="tbpass" runat="server" width="183px"></asp:textbox></td>
                        <td>
                            <asp:requiredfieldvalidator id="requiredfieldvalidator2" runat="server" errormessage="密码不能为空!" controltovalidate="tbpass"></asp:requiredfieldvalidator></td>
                    </tr>
                    <tr>
                        <td><font face="宋体">是否保存cookie</font></td>
                        <td>
                            <asp:checkbox id="persistcookie" runat="server"></asp:checkbox></td>
                        <td></td>
                    </tr>
                </table>
                <asp:button id="btnloginbetter" style="z-index: 101; left: 288px; position: absolute; top: 240px"
                    runat="server" width="78px" text="登录"></asp:button>
                <asp:hyperlink id="hyperlink1" style="z-index: 103; left: 456px; position: absolute; top: 240px"
                    runat="server" navigateurl="default.aspx">hyperlink</asp:hyperlink></font>
        </form>
    </body>
</html>

共3页: 上一页 1 [2] [3] 下一页

发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表