FormsAuthentication.RedirectFromLoginPage(sLoginID,CheckBox1.Checked);
FormsAuthentication.SetAuthCookie(sLoginID,true);以上2句用1句旧可以了吗?
设置以后,我在其他页面中如果想得到设置的sLoginID值,应该如何获取?
FormsAuthentication.SetAuthCookie(sLoginID,true);以上2句用1句旧可以了吗?
设置以后,我在其他页面中如果想得到设置的sLoginID值,应该如何获取?
解决方案 »
- 怎样将dataset内容缓存在客户端
- Html.RenderAction用法
- 求助 ADO.NET entity framework 数据表添加数据的问题
- 很急!
- 请看下这个映射文件的 Model 改 怎么写?因为他用两个字段作为主键
- 关于TextBox的OnTextChanged事件
- VS2005用的超熟的进来看看!!!关于gridview自带的分页的样式问题????
- 请问在 ASP 中有没有功能类似 Private Sub Page_Load() 的函数啊,打开网页就自动执行的
- 关于cookies的问题
- 各位大哥请进,按钮事件问题【文件上传中得】
- 请各位帮忙看看这段ASP.NET中datagrid分页怎么不行?
- 一个网站程序做好了,以哪些后缀名结尾的是业务层?哪些是罗辑层?
FormsAuthentication.SetAuthCookie(sLoginID,true);
你的第二句话是没用的,有第一句就可以了。
{
string str=Request.CookiesSystem.Web.Security.FormsAuthentication.FormsCookieName].Value;
FormsAuthenticationTicket ticket=FormsAuthentication.Decrypt(str);
Response.Write("当前登陆用户:"+ticket.Name);
}
{
string str=
Request.Cookies[System.Web.Security.FormsAuthentication.FormsCookieName].Value;
FormsAuthenticationTicket ticket=FormsAuthentication.Decrypt(str);
Response.Write("当前登陆用户:"+ticket.Name);
}
ticket.Name="用户名"=System.Web.Security.FormsAuthentication.GetAuthCookie("用户名",false)