要先检查Cookies是否存在
If (ctx.Request.Cookies("name").Value is nothing) ...

解决方案 »

  1.   

    学习http://expert.csdn.net/Expert/topic/2457/2457370.xml?temp=7.651919E-02
      

  2.   

    Asp.Net提供了完整的方案,很简单:
    在登录页面的VB文件中:
    Imports System.Web.Security点登录按钮后:
       if 成功 then
          FormsAuthentication.SetAuthCookie(username.Text, False)
       end if在别的页面中:
       If HttpContext.Current.Request.IsAuthenticated Then
           Panel1.Visible = True
       Else
           Panel1.Visible = False
       End If