五月综合缴情婷婷六月,色94色欧美sute亚洲线路二,日韩制服国产精品一区,色噜噜一区二区三区,香港三级午夜理伦三级三

您現(xiàn)在的位置: 365建站網(wǎng) > 365文章 > 關(guān)閉ie前使用js調(diào)用web service操作數(shù)據(jù)庫

關(guān)閉ie前使用js調(diào)用web service操作數(shù)據(jù)庫

文章來源:365jz.com     點(diǎn)擊數(shù):454    更新時(shí)間:2009-09-15 09:50   參與評(píng)論
頁面js
<script language="javascript">
    //關(guān)閉IE提示------------------------------------------------------------
    var i = 0
    document.onkeydown = function KeyDown() {
        if ((event.keyCode == 116) || (event.ctrlKey && event.keyCode == 82)) { //屏蔽 F5 刷新鍵和Ctrl + R
            i = 1;
        }
    }
    function window_onbeforeunload() {
        var a = 0;
        a = top.window.document.body.offsetWidth;
        if (event.clientY > 0 || (event.clientY < 0 && event.screenX < (a - 25))) {//屏蔽右鍵刷新和刷新按鈕
            i = 1;
        }
        if (i != 1) {
            return "你確定要退出本系統(tǒng)?";
        }
    }
    function window.onunload() {  //關(guān)閉ie時(shí)清空session
        var sessionid = '<%=sessionID%>';
        if (i != 1) {
            //alert(sessionid);
            SignOutByPost(sessionid);
        }
    }
    function SignOutByPost(sessionid) {
        var data;
        data = '<?xml version="1.0" encoding="utf-8"?>';
        data = data + '<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">';
        data = data + '<soap:Body>';
        data = data + '<SignOut xmlns="http://tempuri.org/">';
        data = data + '<SessionID>' + sessionid + '</SessionID>';
        data = data + '</SignOut>';
        data = data + '</soap:Body>';
        data = data + '</soap:Envelope>';
        var xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
        var URL = "/iOffice/prg/set/wss/ioCtlSet.asmx";
        xmlhttp.Open("POST", URL, true);
        xmlhttp.SetRequestHeader("Content-Type", "text/xml; charset=utf-8");
        xmlhttp.SetRequestHeader("SOAPAction", "http://tempuri.org/SignOut");
        xmlhttp.Send(data);
      
    
    }
    //-----------------------------------------------------------------
</script>

ioctlset.asmx.vb
Imports System.Web.Services
Imports System.Web.Services.Protocols
Imports System.ComponentModel
' 若要允許使用 ASP.NET AJAX 從腳本中調(diào)用此 Web 服務(wù),請(qǐng)取消對(duì)下行的注釋。
<System.Web.Script.Services.ScriptService()> _
<System.Web.Services.WebService(Namespace:="http://tempuri.org/")> _
<System.Web.Services.WebServiceBinding(ConformsTo:=WsiProfiles.BasicProfile1_1)> _
<ToolboxItem(False)> _
Public Class ioCtlSet
    Inherits System.Web.Services.WebService
    '保存折疊cookies
    <WebMethod()> _
     Public Sub SaveFoldCookies(ByVal empid As Integer, ByVal fold As Boolean, ByVal mode As String)
        Dim cookie As New ioCom.EmpCookie("ioFoldDisplay_" & mode, empid.ToString)
        cookie.ItemAdd("IsFold", fold)
        cookie.SessionFlag = False
        cookie.SaveFoldCookie()
    End Sub
    '結(jié)束當(dāng)前人員在線對(duì)話會(huì)話
    <WebMethod()> _
    Public Sub ifChatClose(ByVal empid As Integer, ByVal chatid As Integer)
        If chatid > 0 Then
            ioSet.DataDel("ifChatEmp", "EmpID", empid, " and chatid=" & pf.SafeSql(chatid.ToString))
        End If
    End Sub
    '關(guān)閉瀏覽器時(shí)做清空操作
    <WebMethod()> _
    Public Sub SignOut(ByVal SessionID As String)
        Dim Log As Integer = 1
        If Not HttpContext.Current Is Nothing Then
            If Log = 1 And ioCom.Profile("PwdPolicy", "StrongLog") = "1" Then '啟用強(qiáng)日志,退出系統(tǒng)寫日志
                Dim dt As DataTable
                Dim eid As String
                Dim ename As String
                Dim ip As String
                dt = SqlData.ExecuteDataset(ioCom.ConnectString, CommandType.Text, "select * from ssLogInfo where SessionID='" + SessionID + "'").Tables(0)
                If dt.Rows.Count = 1 Then
                    eid = dt.Rows(0)("LoginID").ToString
                    ename = dt.Rows(0)("UserName").ToString
                    ip = dt.Rows(0)("LoginIP").ToString
                    ioSet.ssActLogAdd(ename, "退出系統(tǒng)", "登錄表", "", ip, eid, 1, 1)
                End If
            End If
            '清除會(huì)話變量,關(guān)閉聯(lián)接記錄
            SqlData.ExecuteNonQuery(ioCom.ConnectString, "ssLoginSessionClose", SessionID)
            '清除配置緩存
            pf.RemoveCache("EmpProfile" & SessionID)

            '標(biāo)示已注銷
            System.Web.Security.FormsAuthentication.SignOut()
            HttpContext.Current.Session.Clear()
            HttpContext.Current.Session.Abandon()
            Try
                Dim iNum As Integer
                Dim sql As String
                sql = "select count(sessionid) "
                sql &= " from ssloginfo WITH(NOLOCK) "
                sql &= " where status=1 and not(empid is null)"
                iNum = SqlData.ExecuteScalar(ioCom.ConnectString, CommandType.Text, sql)
                ioCom.OnLineNum = iNum
            Catch ex As Exception
            End Try
        End If

    End Sub

End Class

如對(duì)本文有疑問,請(qǐng)?zhí)峤坏浇涣髡搲?,廣大熱心網(wǎng)友會(huì)為你解答??! 點(diǎn)擊進(jìn)入論壇

發(fā)表評(píng)論 (454人查看0條評(píng)論)
請(qǐng)自覺遵守互聯(lián)網(wǎng)相關(guān)的政策法規(guī),嚴(yán)禁發(fā)布色情、暴力、反動(dòng)的言論。
昵稱:
最新評(píng)論
------分隔線----------------------------
大家感興趣的內(nèi)容
最近更新的內(nèi)容

其它欄目

· 建站教程
· 365學(xué)習(xí)

業(yè)務(wù)咨詢

· 技術(shù)支持
· 服務(wù)時(shí)間:9:00-18:00
365建站網(wǎng)二維碼

Powered by 365建站網(wǎng) RSS地圖 HTML地圖

copyright © 2013-2024 版權(quán)所有 鄂ICP備17013400號(hào)