网页退出

<script language="javascript">
    var bClosing = true;
    function document.onclick()
    {
     var e = event.srcElement;
     if (e.tagName == "A" || (e.tagName == "INPUT" && e.type == "submit"))
         bClosing = false;
    }
    function window.onunload()
    {
        if(bClosing)
            StationData_StationDiagnose.Exit();
    }
    </script>

    AjaxPro.Utility.RegisterTypeForAjax(typeof(StationData_StationDiagnose));


    [AjaxPro.AjaxMethod]
    public void Exit()
    {
        string stationID = HttpContext.Current.Session["TransmissionIDMap"].ToString();
        if (stationID != null)
        {
            stationID = mFun.GetStationIDFromID(stationID);
        }
        string badge = stationID;

        string strPath = Server.MapPath("");
        strPath = strPath.Remove(strPath.LastIndexOf("\\")+1);
        strPath += "StationData\\ReturnFile\\dir\\" + badge + "-SSS" + ".txt";
        string strContent = "23432";

        FileOP.FileDel(strPath);
        FileOP.WriteFile(strPath, strContent);
    }

posted on 2010-02-23 13:03  carekee  阅读(379)  评论(0)    收藏  举报