如题:
另外在请教,如何控制不登陆的情况下不能进入登陆后的界面,2个问题!!

解决方案 »

  1.   

    如何点击网页上最右边的X后释放该用户的session
    ---------------------
    这个ASP.NET自己会释放,不用你去释放,你也扑获不到用户点击X这个事件另外在请教,如何控制不登陆的情况下不能进入登陆后的界面,2个问题!!
    ---------------------------
    简单的就是在用户登入后把登入信息保存到session,在登陆后的界面的page_load中去判断用户登入的session是否存在,如果存在就表示已登入,否则就跳转到登入页面,复杂一点:用ASP.NET的form验证,具体可以上博客园去搜索下这个资料
      

  2.   

    前台:
    <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Index1.aspx.cs" Inherits="Index1" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml" >
    <head runat="server">
        <title>无标题页</title>
        <script type="text/javascript">
          function window.onunload()
          {
             Index1.unload();
          }
        </script>
    </head>
    <body>
        <form id="form1" runat="server">
       
        <div>
        
        </div>
        </form>
    </body>
    </html>
    后台:
    using System;
    using System.Data;
    using System.Configuration;
    using System.Collections;
    using System.Web;
    using System.Web.Security;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    using System.Web.UI.WebControls.WebParts;
    using System.Web.UI.HtmlControls;public partial class Index1 : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            AjaxPro.Utility.RegisterTypeForAjax(typeof(Index1));
        }
        [AjaxPro.AjaxMethod]
        public string unload()
        {
            HttpContext.Current.Session.Abandon();
        }
    }
    问题2.web.config配置 <authentication mode="Forms">      <forms name=".VS2005_Form" loginUrl="~/Security/Login.aspx" defaultUrl="~/Default.aspx"
              protection="All" timeout="30" path="/" requireSSL="false"
              slidingExpiration="true" enableCrossAppRedirects="false"
              cookieless="UseDeviceProfile">
          </forms>    </authentication>
      

  3.   

    能不能在global.asax里头写上Session_End事件处理逻辑呢?
      

  4.   

    严谨一点,试一试onunload都如何触发。
      

  5.   

    关闭窗体Session自动会释放的~!