某个页面不可访问的权限

版权声明: https://blog.csdn.net/eds124/article/details/86485530
<%@ Page Language="VB" %>

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

<script runat="server">
    Dim sds As SqlDataSource = New SqlDataSource(Dao.ConnectionString, "select b from t_user where username = @username and userpass = @userpass")
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)
        If Request.Cookies("username") Is Nothing Or Request.Cookies("userpass") Is Nothing Or Request.Cookies("username").Value = "" Or Request.Cookies("userpass").Value = "" Then
            Response.Redirect("~/Default.aspx")
            Return
        End If
        sds.SelectParameters.Add("username", Request.Cookies("username").Value)
        sds.SelectParameters.Add("userpass", Request.Cookies("userpass").Value)
        If CType(sds.Select(DataSourceSelectArguments.Empty), System.Data.DataView)(0)(0) = 0 Then
            Response.Redirect("~/Index.aspx")
            Return
        End If
    End Sub
</script>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:Login ID="Login1" runat="server">
        </asp:Login>
    </div>
    </form>
</body>
</html>

猜你喜欢

转载自blog.csdn.net/eds124/article/details/86485530