Session 超时弹出登录框。

                            //在Ajax 里 在脚本里 添加 top ,可把IE搞死.
                            string strJs =
                                CmnProc.GetJsInclude(
                                    (HttpContext.Current.Handler 
as Page).ClientScript.GetWebResourceUrl(BuildManager.GetType("WebCon._Page_Resource"false), "WebCon.jquery-1.3.1.js")
                                    , 
false"""")
                                     
+
                                CmnProc.GetJsInclude(
                                    (HttpContext.Current.Handler 
as Page).ClientScript.GetWebResourceUrl(BuildManager.GetType("WebCon._Page_Resource"false), "WebCon.NewCmn.js")
                                    , 
false"""")
                                     
+
                                CmnProc.GetJsInclude(
                                    (HttpContext.Current.Handler 
as Page).ClientScript.GetWebResourceUrl(BuildManager.GetType("WebCon._Page_Resource"false), "WebCon.jquery.corner.js")
                                    , 
false"""")
                                     
+
                                
string.Format(@"
            <script>
            if ( typeof(window.dialogArguments) != ""undefined"" && typeof(window.opener) == ""undefined"")
            {{
                $(""form"").html(""<div style='width:100%;height: 100%;text-align:center;vertical-align:middle'><br/><br/><br/><br/><br/>操作已超时, 请刷新主窗体进行登录!</div>"");
            }}
            else
            {{
                var pw = top ;
                if ( pw.frameElement !=null )
                {{
                    pw = pw.frameElement  ;
                }}
                if ( pw.ownerDocument != null )
                {{
                    pw = pw.ownerDocument ;
                }}
                if ( pw.parentWindow != null )
                {{
                    pw = pw.parentWindow ;
                }}
                if ( pw.top != null )
                {{
                    pw = pw.top ;
                }}
                if( pw.Popd == undefined || pw.Popd == null)
                {{
                pw.Popd = 1 ;
            
                $(""form"").html("""");
            
                document.clear();
                document.writeln(""正在刷新登录,请稍等."") ;
            
                var sFeature = 'dialogWidth:380px; dialogHeight:300px; center:yes; help:no; resizeble:no; scroll:no; status:no';
                var retVal = showModalDialog(""{0}"",'',sFeature) ;
            
                if ( retVal == true || retVal == 'true' )
                {{
                    if ( top.location.href.indexOf('#') < 0 )
                    {{
                        top.location = top.location.href ;
                    }}
                    else
                    {{
                        top.location = top.location.href.substr(0 ,top.location.href.indexOf('#')) ;
                    }}
                }}
                }}
            }}
            </script>
""Admin/LoginPop.aspx".GetUrlFull());

                            ScriptManager sm 
= ScriptManager.GetCurrent(HttpContext.Current.Handler as Page);

                            
if (sm == null)
                            {
                                HttpContext.Current.Response.Write(strJs);
                                
//HttpContext.Current.Response.End();
                            }
                            
else
                            {
                                ScriptManager.RegisterStartupScript(HttpContext.Current.CurrentHandler 
as Page, typeof(string), "login", strJs, false);
                            }
                            
//ScriptManager.RegisterStartupScript(HttpContext.Current.CurrentHandler as Page, typeof(string), "login", strJs, false);
                        }

 

在超时后, 会弹出登录框,即使弹出登录框,它也会执行页面的Load 事件或回发事件。

posted @ 2009-05-10 12:52  NewSea  阅读(2484)  评论(0编辑  收藏  举报