如何点击网页上最右边的X后释放该用户的session 如题:另外在请教,如何控制不登陆的情况下不能进入登陆后的界面,2个问题!! 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 如何点击网页上最右边的X后释放该用户的session---------------------这个ASP.NET自己会释放,不用你去释放,你也扑获不到用户点击X这个事件另外在请教,如何控制不登陆的情况下不能进入登陆后的界面,2个问题!!---------------------------简单的就是在用户登入后把登入信息保存到session,在登陆后的界面的page_load中去判断用户登入的session是否存在,如果存在就表示已登入,否则就跳转到登入页面,复杂一点:用ASP.NET的form验证,具体可以上博客园去搜索下这个资料 前台:<%@ 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> 能不能在global.asax里头写上Session_End事件处理逻辑呢? 严谨一点,试一试onunload都如何触发。 关闭窗体Session自动会释放的~! 在XML里面:欧洲编码的汉字是"欧洲",这是什么编码?大侠们帮忙 大家帮帮忙 关于两个panel的问题.急! 求一个思路!热心的朋友请进! 请问,SELECT查询后,如何得到某个字段的值?? net里怎样实现“目录及其内容的复制”? 我买了一本书,示例项目中专门有一个类是接口类,定义了许多接口,可是不是很清楚这些接口是如何应用到程序中去的? web用户控件,能不能在使用它的页面中用代码操纵该控件? 请教关于在WEB上建立邮件系统的问题。 DataGrid怎樣得到當前頁有几條記錄?謝謝 RadComboBox 控件的问题 关于GridView
---------------------
这个ASP.NET自己会释放,不用你去释放,你也扑获不到用户点击X这个事件另外在请教,如何控制不登陆的情况下不能进入登陆后的界面,2个问题!!
---------------------------
简单的就是在用户登入后把登入信息保存到session,在登陆后的界面的page_load中去判断用户登入的session是否存在,如果存在就表示已登入,否则就跳转到登入页面,复杂一点:用ASP.NET的form验证,具体可以上博客园去搜索下这个资料
<%@ 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>