在新选项卡中打开文件 [英] Open a file in a new tab
问题描述
HEllo Experts,
我正在创建一个PDF表单并填写Vb.net中的字段。那部分我做得很好。现在我尝试单击按钮以填充PDF表单,然后在新的选项卡/窗口中打开它。
这是我的代码
以下代码在Page1.aspx
HEllo Experts,
I am working on quite bit sometime on creating a PDF form and filling the fields from Vb.net. I was doing pretty good on that part. Now I am trying to click on a button to Fill the PDF Form and then open it in a new tab/window.
Here is my code
below code is in Page1.aspx
ListFieldNames()
FillForm()
Server.Transfer("~/Page2.aspx")
在Page2.aspx中我喜欢以下
In Page2.aspx I have like below
Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Load
Response.ContentType = "Application/pdf"
Response.AddHeader("content-length", Session("binaryData").ToString().Length.ToString())
Response.BinaryWrite(Session("binaryData"))
Response.End()
End Sub
但是,它没有在新标签/窗口中打开。
如果有人可以帮我这个,我将不胜感激。
However, it is not opening in new tab/window .
I would appreciate if someone can help me with this.
推荐答案
下面是确切的链接以帮助您解决问题所需。
提前致谢。
http:// www .aspsnippets.com / Articles / ASP.Net-Response.Redirect-or-Server.Transfer-Open-new-window.aspx [ ^ ]
Hi, below is the exact link to help what you need to solve your query.
Thanks in advance.
http://www.aspsnippets.com/Articles/ASP.Net-Response.Redirect-or-Server.Transfer-Open-new-window.aspx[^]
尝试向浏览器发送重定向以在新窗口中打开page2,而不是传输。
Instead of a transfer, try send a redirect to the browser to open page2 in a new windows.
response.write("<script>");
response.write("window.open('page2.html','_blank')");
response.write("</script>");
欲了解更多信息,请点击此处:
http://www.aspsnippets.com/Articles/ASP.Net-Response.Redirect- or-Server.Transfer-Open-new-window.aspx [ ^ ]
祝你好运!
For more info, check here:
http://www.aspsnippets.com/Articles/ASP.Net-Response.Redirect-or-Server.Transfer-Open-new-window.aspx[^]
Good luck!
无论什么请求Page1需要在新窗口中请求它。如果通过表单提交获得page1.aspx,则需要_blank作为表单上的目标
< form target =_ blankaction =page1.aspx >
或者如果page1.aspx是通过链接获得的话
< a target =_ blankhref =page1.aspx...
Whatever requests "Page1" needs to request it in a new window. If page1.aspx is got to via a form submission you need _blank as a target on the form
<form target="_blank" action="page1.aspx">
or if page1.aspx is got to via a link
<a target="_blank" href="page1.aspx" ...
这篇关于在新选项卡中打开文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!