FormsAuthentication:ASP.NET FORM验证
来源:互联网 发布:大数据工程师干什么 编辑:程序博客网 时间:2024/05/16 01:13
- //密码验证过程在此省略,假如用户名是mxh,密码是mengxianhui
- String UserName = "mxh";
- FormsAuthenticationTicket ticket = new FormsAuthenticationTicket(2,//票证的版本号
- UserName,//与身分验证票关联的用户名
- DateTime.Now, //票证发出时的本地日期和时间
- DateTime.Now.AddHours(1),//票证过期的本地日期和时间
- true,// 如果票证存储在持久性cookie中(跨浏览器会话保存)则为 true 否则为false 如果票证储存在URL中,将忽略此值
- "reader",//储存在票证中持定的用户信息,本页面供 reader 登录使用
- FormsAuthentication.FormsCookiePath //票证储存在cookie中的路径
- );
- //如果 forms 元素的 protection 属性设置为 All 或 Encryption,则窗体身份验证使用 Encrypt 方法对窗体身份验证票进行加密和签名。
- string encTicket = FormsAuthentication.Encrypt(ticket);
- HttpCookie cookie = new HttpCookie(FormsAuthentication.FormsCookieName, encTicket);
- Response.Cookies.Add(cookie);
- Response.Redirect(FormsAuthentication.GetRedirectUrl(UserName, true));
userid = HttpContext.Current.User.Identity.Name
string cookieName = FormsAuthentication.FormsCookieName;
- FormsAuthentication:ASP.NET FORM验证
- Asp.NET FormsAuthentication
- asp.net form验证
- asp.net form验证
- asp.net form验证
- asp.net form验证
- asp.net form验证
- Asp.Net Form验证
- ASP.NET Form 角色验证
- ASP.NET Form验证随笔
- asp.net的Form验证
- Asp.NET MVC用System.Web自带方法写入FormsAuthentication验证
- asp.net 特定目录form验证!
- ASP.NET Form验证和角色权限
- ASP.NET表单验证之Form
- Asp.Net 用户验证(自定义IPrincipal和IIdentity) form 验证
- asp.net中基于Form验证的角色授权验证
- ASP.NET_FORM表单验证_单点登录_Nomads (FormsAuthentication)
- TI DSP/BIOS及CCS使用经验
- 华为面经记
- Quartz Cron 表达式(时间格式的写法)
- CharacterEncodingFilter by Spring class
- 预览ExtJS 4.0的新功能(三):客户端数据层的革新:引入ActiveRecord模式
- FormsAuthentication:ASP.NET FORM验证
- js 字符串处理
- CCS3.1 DSP/BIOS 配置工具使用经验
- 被调函数的作用域问题
- 用CCS开发DSP应用程序的代码结构、加电装载及在线编程
- 市场的存在
- [转]一份比较详细的DOS命令说明!
- linux C/C++ 静态库、共享库
- 多家软件厂商卷入360与腾讯之争