可以啊!在web.config那个文件中就有设置相关的验证!

解决方案 »

  1.   

    ASP的方式这里照样可以用ASP.Net为你封装了一般的Form验证的功能,如果你的要求不是非常高,就可以很方便的利用它
    首先,在你的Web.Config中配置:
    <authentication mode="forms">
         <forms forms="401kApp" 
                 loginurl="/login.aspx" 
                 decryptionkey="1!#$$*13^">
              <credentials passwordFormat=SHA1>
                   <user name="Kim" password="9611E4F94EC4972D5A537EA28C69F89AD28E5B36"/>
                   <user name="John" password="BA7157A99DFE9DD70A94D89844A4B4993B10168F"/>
              </credentials>
         </forms>
    </authentication>其次,编写登陆页面验证用户名和密码之后,调用:FormsAuthentication.RedirectFromLoginPage("用户名",false);这一句就OK了具体请参考:ms-help://MS.VSCC/MS.MSDNVS.2052/cpguide/html/cpconthecookieauthenticationprovider.htm