FormsAuthentication.GetAuthCookie(LoginStr[1].Trim(), false);
这个已经成功了,但User.Identity.Name为什么取不到值?
这个已经成功了,但User.Identity.Name为什么取不到值?
解决方案 »
- 求牛人指点:我的iis有问题,我想能不能用vs代替iis,实现根目录浏览
- 错误汇总控件的ShowMessageBox属性设置为True,但是在服务器不弹出提示框是怎么回事啊?
- 如何用sql按时间模糊查询
- js 简单的日期加1的问题
- js修改问题
- 怎么触发gridview里面的templatefield中的radiobutton事件
- 怎么才能让response.write返回的使alert智能一点?
- 100分求解有关Forms验证的奇怪问题,高手帮帮忙!急!!解决马上揭帖给分!
- 如何取得DataGrid中帮定的Radio控件的直
- 老问题,老是出现,帮我看看,是不是没有Fill??????
- 求一个和“http://www.tudou.com/”登录中记住我的功能代码
- 关于同时操作二个数据库的问题
是FormsAuthentication.SetAuthCookie(LoginStr[1].Trim(), false);
if(HttpContext.User.Identity.IsAuthenticated)
判断下试试
what about your web.config file?it should like this: <authentication mode="Forms">
<forms name="shli" loginUrl="~/Login.aspx" protection="All"></forms>
</authentication>
<authorization>
<deny users="?"/>
</authorization>
if (HttpContext.Current.User.Identity.IsAuthenticated)
{
Response.Write(HttpContext.Current.User.Identity.Name.ToString());
}
根本不走Response.write,说明SetAuthCookie失败了~
<forms name="XXX" path="/" loginUrl="default.aspx" protection="All" timeout="60" defaultUrl="default.aspx">
</forms>
</authentication>