Top.aspx页面:
<body οnunlοad="LogOut()">
</body>
<script type="javascript/text" >
function LogOut() { var c= Ufida.T.UI._top.RecordLogOut(); }
</script>
Top.aspx.cs:
namespace Ufida.T.UI { public partial class _top : BasePage { protected void Page_Load(object sender, EventArgs e) { this.CheckLogin(); AjaxPro.Utility.RegisterTypeForAjax(typeof(_top)); this.labUserName.Text = this.userDTO.UserName; if (Session["usercount"] != null) { this.lblzds.Text = Session["usercount"].ToString(); } //this.labOrgName.Text = strUserOrgName } [AjaxPro.AjaxMethod()] public string RecordLogOut() { //add by yxh 2010-12-02 注销加密站点 UserDTO udto = Session["userdto"] as UserDTO; bool b = LDHTSCManager.Logout(udto.UserName); try { string id = Session["loginid"].ToString(); string logTime = DateTime.Now.ToString(); SQLDataModuleService module = new SQLDataModuleService(); int count = module.ExecuteSql("update LOG_LOGIN set ENDDATE='" + DateTime.Parse(logTime) + "' where ID='" + id + "'"); Session.Clear(); return "1"; } catch (Exception ex) { Session.Clear(); return "0"; } } } }