首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > asp.net >

window.open弹出的网页不到两秒自己关了?怎么处理

2012-01-31 
window.open弹出的网页不到两秒自己关了?怎么办?首先入口是abc.aspx,从某个GridView的OnRowCommand开始:pr

window.open弹出的网页不到两秒自己关了?怎么办?
首先入口是abc.aspx,从某个GridView的OnRowCommand开始:
        protected   void   GridView1_RowCommand(object   sender,   GridViewCommandEventArgs   e)
        {
                int   iIdx   =   Convert.ToInt32(e.CommandArgument);
                if   (e.CommandName   ==   "Print ")
                {
                        //Session[ "PrintFileID "]   =   GridView1.DataKeys[iIdx][ "流水号 "].ToString();
                        string   sLiuShuiID=   GridView1.DataKeys[iIdx][ "流水号 "].ToString();
                        Response.Write( " <script> window.open( 'SendFileNew.aspx?id= "   +   sLiuShuiID   +   " ') </script> ");
                }
        }

ShowFile.aspx的page_load事件里有:
                        string   sPath   =   dt.Rows[0][ "附件 "].ToString();     //   如果有附件
                        if   (sPath   !=   " ")
                        {
                                sPath   =   Server.MapPath( "~ ")   +   sPath;
                                Session[ "AttachmentPath "]   =   sPath;       //   暂用Session传
                                Response.Write( " <script> window.open( 'PrintAttachment.aspx ') </script> ");
                        }

PrintAttachment.aspx的page_load事件里有:
                string   sPath   =   Session[ "AttachmentPath "].ToString();
                FileInfo   DownloadFile   =   new   FileInfo(sPath);
                if   (DownloadFile.Exists)
                {
                        Response.Clear();
                        Response.ClearHeaders();
                        Response.Buffer   =   false;
                        Response.ContentType   =   "application/octet-stream ";
                        Response.AppendHeader( "Content-Disposition ",   "attachment;filename= "   +   HttpUtility.UrlEncode(DownloadFile.FullName,   System.Text.Encoding.UTF8));


                        Response.AppendHeader( "Content-Length ",   DownloadFile.Length.ToString());
                        Response.WriteFile(DownloadFile.FullName);
                        Response.Flush();
                        Response.End();
                }

我选了一个有附件的文件,ShowFile.aspx都顺利弹出,同时应该会弹出PrintAttachment.aspx并出现 "打开 ", "保存 "的那个对话框,有些电脑上可以正常显示PrintAttachment.aspx,但是很多电脑上PrintAttachment.aspx闪了一下就自己关了,估计是IE设置的问题,我调了半天也没弄好..

本来以为是拦截弹出窗口的问题,但是一想:既然ShowFile.aspx可以弹出,为什么PrintAttachment.aspx不行..不是拦截窗口的问题..那是为什么呢?


[解决办法]
脚本语言里面设置下弹出的时间.可以进行时间设定.
相关的你就去搜下.这个很多现成的.

[解决办法]
关注
[解决办法]
我的也老关,是看XXX网时,杀毒软件给关的,不知道您的是不。菜也要菜的有水平。我就是。
[解决办法]
PrintAttachment.aspx.cs 中 你已经显示指定是下载文件:

Response.ContentType = "application/octet-stream ";
Response.AppendHeader( "Content-Disposition ", "attachment;filename= " +

应该弹出提示是否保存文件的窗口不对嘛?

热点排行