<authentication mode="Forms">
       <forms name="LandTransAuth" loginUrl="Default.aspx"  protection="All" timeout="60" path="/" >
       </forms>
</authentication>我跟踪了一下,发现调用顺序正常
FormsAuthentication.SetAuthCookie(login.UserID.ToString(), chkRememberLogin.Checked);
->
FormsAuthentication.SignOut();
->
if ( Request.IsAuthenticated )
->
但不知为什么,最后一句总是true,除非把浏览器关了重打开
(我上面几句分别放在不同的aspx里面,应该不影响吧,)

解决方案 »

  1.   

    Request.IsAuthenticated是对当前的请求而言的,FormsAuthentication.SignOut()的作用是把认证Cookie过期,为了你的目的,在FormsAuthentication.SignOut()之后,用Response.Redirect
      

  2.   

    把if ( Request.IsAuthenticated )換成if ( User.IsAuthenticated )即可
      

  3.   

    不好意思,應該是if(User.Identity.IsAuthenticated)
      

  4.   

    哦,终于搞定了
    FormsAuthentication.SignOut();之后好像就不能对其他cookie进行操作,要紧跟redirect语句,我调换了顺序就搞定了,谢谢各位