AI智能
改变未来

ASP.NET WEB配置

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>\");}
赞(0) 打赏
未经允许不得转载:爱站程序员基地 » ASP.NET WEB配置