asp.net 身份验证
<authentication mode="Forms">
<forms loginUrl="Default.aspx" name=".ASPXAUTH"></forms>
</authentication>
<authorization>
<deny users="?"/>
</authorization>
这个东西,我在后台代码中有
SqlConnection conn;
SqlCommand cmd;
string cmdString = "select password from admin where uid = '" + this.Login1.UserName + "' and password = '" + this.Login1.Password + "'";
conn = new SqlConnection("Data Source = .;Initial Catalog = lianxi; Integrated Security = true");
cmd = new SqlCommand(cmdString, conn);
conn.Open();
SqlDataReader myReader;
myReader = cmd.ExecuteReader();
if (myReader.Read())
{
FormsAuthentication.RedirectFromLoginPage(this.Login1.UserName, false);
//Server.Transfer("Default2.aspx");
Response.Redirect("Default2.aspx");
}
else
{
Response.Write("Invalid credentials");
}
myReader.Close();
现在当用户输入正确的用户名和密码之后,可以在地址栏中直接进入其它的页面.
但是现在我还想有一个验证,是用来区分 管理员 与 普通用户的 该怎么做?