如何让Response.Redirect 也打开新窗口

来源:互联网 发布:红警手游扫矿软件 编辑:程序博客网 时间:2024/05/01 01:12

对于reasponse.redirect()也许大家都知道它的服务器端进行转向。因此,除非使用 Response.Write("<script>window.location='http://hi.baidu,com/19xier;</script>") 方法外,是不能在新窗口打开所指定的 URL 地址的。但是,如果仔细分析一下,如果设置 form 元素的 target 属性,还是有办法打开新窗口的。下面就是.

在page_load中

this.btngoto.Attributes.Add("onclick","this.form.target='_newName';"); //_newName 可以换成target的所有属性值。

btngoto_click(....)

{ response.redirect(http://hi.baidu.com/19xier);}

这样,就可以实现类似与response.write()的效果了。