使用Forms Authentication实现用户注册、登录 (一)基础知识

//先导入Forms命名空间
using System.Web.Security;

//然后授权
FormsAuthentication.SetAuthCookie("用户名", true);

//之后在下次请求发生时user.identity.name就不会为空了

user.identity.name
=="用户名"//true

posted @ 2012-02-10 00:08  becket  阅读(721)  评论(0编辑  收藏  举报