如何使用Response.Redirect在新窗口中打开链接 [英] How to open link in new window using Response.Redirect
本文介绍了如何使用Response.Redirect在新窗口中打开链接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何使用Response.Redirect()在新窗口中打开链接。我想使用button_Click下的代码在新窗口中打开页面。
解决方案
查看此博客
http://stackoverflow.com/questions/104601/asp-net-response-redirect-to-new-window [ ^ ]
--NDK
我使用Response.Redirect打开一个新窗口的最佳方法之一是其他 [ ^ ]。正如它所述,你无法使用标准重定向方法打开一个新窗口,因为它在内部工作(即它发送一个特殊的HTTP请求来触发重定向),所以你需要应用一点mojo来使它工作。
在按钮点击事件中使用此代码(代码隐藏)它将在新窗口中打开页面
string url = WebForm.aspx跨度>;
Response.Write( < script type ='text / javascript'> window.open(' + url + ');< / script>);
Hi,
How to open a link in new window using Response.Redirect(). I want to open the page in new window using code under button_Click.
解决方案
check this blog
http://stackoverflow.com/questions/104601/asp-net-response-redirect-to-new-window[^]
--NDK
One of the neatest ways I've ssen to open a new window with Response.Redirect is indicated here[^]. As it states, you cannot open a new window with the standard redirect method because of the way it works internally (i.e. it sends a special HTTP request to trigger the redirect), so you need to apply a little bit of mojo to get it working.
Use this code in button click event (code behind) it will open the page in new window
string url = "WebForm.aspx"; Response.Write("<script type='text/javascript'>window.open('" + url + "');</script>");
这篇关于如何使用Response.Redirect在新窗口中打开链接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文