asp.net
登录页面web配置 当from验证:
第一种:
<authentication mode=\"Forms\"><forms loginUrl=\"Login.aspx\" defaultUrl=\"Admin/MemberList.aspx\"><credentials passwordFormat=\"Clear\"><user name=\"admin\" password=\"123\"/><user name=\"guest\" password=\"234\"/></credentials></forms></authentication><location path=\"Admin\"> --文件夹<system.web><authorization><allow users=\"admin\"/><deny users=\"?,guest\"/></authorization></system.web></location>
第二种简单的:
authentication mode=\"Forms\"><forms loginUrl=\"Login.aspx\" defaultUrl=\"Admin/MemberList.aspx\"><credentials passwordFormat=\"Clear\"><user name=\"admin\" password=\"123\"/><user name=\"guest\" password=\"234\"/></credentials></forms></authentication><authorization><allow users=\"admin\"/><deny users=\"?,guest\"/></authorization>
要在登录页面时搞验证记得using System.Web.Security;
if (FormsAuthentication.Authenticate(txtname.Text,txtpwd.Text)){FormsAuthentication.RedirectFromLoginPage(txtname.Text,true);}else{Response.Write(\"账号或密码错误<script>location:\'Login.aspx\';</script>\");}