Request.IsAuthenticated =false的问

zhanghe100 2009-08-25 09:35:34
HttpContext.Current.Request.IsAuthenticated == true
用表单提交登录后,在一个类里判断是否登录成功IsAuthenticated 总是=假,为什么
以前不在表在中好用啊
...全文
180 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
zhanghe100 2009-08-26
  • 打赏
  • 举报
回复

<!--验证方式及设置-->
<authentication mode="Forms">
<forms loginUrl="LoginDl.aspx" name=".yinyuebbCoName"></forms>
</authentication>



<authorization>
<allow users="*"/>
</authorization>


这样设置的
wubing1111 2009-08-26
  • 打赏
  • 举报
回复
webconfig裡是不是沒有設置Form驗證啊
zhanghe100 2009-08-26
  • 打赏
  • 举报
回复
恩,我去看看
chen_ya_ping 2009-08-26
  • 打赏
  • 举报
回复
Form表单的验证。具体的可以看看网上的资料。cnbologs上有你可以去看看
zhanghe100 2009-08-26
  • 打赏
  • 举报
回复


if (HttpContext.Current.User != null)
{

if (HttpContext.Current.Request.IsAuthenticated == true) //验证过的一般用户才能进行角色验证
{
System.Web.Security.FormsIdentity fi = (System.Web.Security.FormsIdentity)HttpContext.Current.User.Identity;
System.Web.Security.FormsAuthenticationTicket ticket = fi.Ticket; //取得身份验证票
}
return "";
}
else
return "";


还是不行啊
l8487 2009-08-25
  • 打赏
  • 举报
回复
自定义类
public class Class1
{
public string Mth()
{
return HttpContext.Current.Request.IsAuthenticated.ToString();
}
}
页面调用
protected void Button1_Click(object sender, EventArgs e)
{
Class1 c = new Class1();
Response.Write(c.Mth());
}
返回值为true;

62,047

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术交流专区
javascript云原生 企业社区
社区管理员
  • ASP.NET
  • .Net开发者社区
  • R小R
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

.NET 社区是一个围绕开源 .NET 的开放、热情、创新、包容的技术社区。社区致力于为广大 .NET 爱好者提供一个良好的知识共享、协同互助的 .NET 技术交流环境。我们尊重不同意见,支持健康理性的辩论和互动,反对歧视和攻击。

希望和大家一起共同营造一个活跃、友好的社区氛围。

试试用AI创作助手写篇文章吧