User.Ident.Name
来源:互联网 发布:域名到期了怎么办 编辑:程序博客网 时间:2024/06/02 04:25
webconfig 配置
<authentication mode="Forms">
<forms name="forums" path="/" loginUrl="Login.aspx" protection="All" timeout="40">
</forms>
</authentication>
用户登录
/// <summary>
/// 用户登陆
/// </summary>
/// <param name="username">用户名</param>
/// <param name="roles">权限</param>
/// <param name="isPersistent">输入true时,Cookies存在的时间是一个月!输入false时,Cookies存在时间是一小时</param>
public static void Login(string username, string roles, bool isPersistent)
{
DateTime dt = isPersistent ? DateTime.Now.AddDays(30) : DateTime.Now.AddMinutes(60);
FormsAuthenticationTicket ticket = new FormsAuthenticationTicket(
1, // 票据版本号
username, // 票据持有者
DateTime.Now, //分配票据的时间
dt, // 失效时间
isPersistent, // 需要用户的 cookie
roles, // 用户数据,这里其实就是用户的角色
FormsAuthentication.FormsCookiePath);//cookie有效路径
//使用机器码machine key加密cookie,为了安全传送
string hash = FormsAuthentication.Encrypt(ticket);
HttpCookie cookie = new HttpCookie(FormsAuthentication.FormsCookieName, hash); //加密之后的cookie
//将cookie的失效时间设置为和票据tikets的失效时间一致
if (ticket.IsPersistent)
{
cookie.Expires = ticket.Expiration;
}
//添加cookie到页面请求响应中
HttpContext.Current.Response.Cookies.Add(cookie);
}
- User.Ident.Name
- ident-user-enum
- PostgreSQL: IDENT authentication failed for user postgres
- OperationalError: FATAL: Ident authentication failed for user “postgres”
- user-ident为需要复位的计数器名称
- psql: FATAL: Ident authentication failed for user “postgres”
- 身份识别协议枚举工具ident-user-enum
- Ubuntu change user name
- CENTOS针对POSTGRES出现的POSTGRESQL IDENT AUTHENTICATION FAILED FOR USER
- psql -U myusername mydb 错误:psql: FATAL: Ident authentication failed for user "mypguser"
- 【Linux】psql: FATAL: Ident authentication failed for user "username" Error and Solution
- sysbench下面测试postgresql遇到IDENT authrntication failed for user postgres
- GIT 初始化 user.name user.email
- git修改user.name和user.email
- git配置user.name和user.email
- Context.User.Identity.Name说明
- httpd: bad user name apache
- ajax 1 : check user name
- POJ 2785 4 Values whose Sum is 0
- 黑马学习--------------------反射(执行方法)
- 二战十大致命武器之B-29“超级空中堡垒”轰炸机
- Ubuntu Desktop 变为 Ubuntu Server 服务器版的方法
- linux下执行Sh文件报告bin/sh^M: bad interpreter: No such file or directory
- User.Ident.Name
- 二战十大致命武器之“埃塞克斯”级航空母舰
- SAP供应商主数据_基本视图
- 3D中带光照的骨骼动画原理
- SQL Server2005 Reporting Service配置步骤
- 二战十大致命武器之雷达
- GridView添加表头表尾以及合并相同项
- 二战十大致命武器之“喷火”式战斗机
- 字符集和字符编码(Charset & Encoding)