Click here to Skip to main content
15,880,967 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
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
VB
ListFieldNames()
       FillForm()
       Server.Transfer("~/Page2.aspx")



In Page2.aspx I have like below
VB
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.
Posted
Comments
Sergey Alexandrovich Kryukov 27-Jul-15 13:17pm    
Where do you think you are trying to open a browser window? Besides, it's a bad idea: this would be a pop-up, and pop-ups can be blocked on the client side by the users who hate them (for some good reasons).
—SA
sudevsu 27-Jul-15 14:43pm    
Ok Instead asking the user to Save/ Open / cancel like an attachment would be better?
Sergey Alexandrovich Kryukov 27-Jul-15 14:47pm    
I don't understand, what "attachment"? First of all, what do you want to achieve? Why would you need to show anything in a separate window? You can 1) show new data in response to user action on the same window, 2) show some link to new data, so the user could decide how to navigate to it: on the same window, new window or tab.
—SA
sudevsu 27-Jul-15 15:00pm    
Yeah when I say Attachment , I mean something like
show new data in response to user action on the same window

Open Save Cancel.
I think that's what you mean. I have done with this as solution for now.
But I really want to new tab / window because most of the dealers using the site are not computer literates , so they want everything open and requested for this
Sergey Alexandrovich Kryukov 27-Jul-15 15:04pm    
Surely it can be better than a pop-up.
You are talking about inexperienced users. For such people, the best model is a single Web window. Such user can easily "loose" either new or, more likely, original window or a tab.
—SA

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[^]
 
Share this answer
 
Instead of a transfer, try send a redirect to the browser to open page2 in a new windows.
XML
response.write("<script>");
response.write("window.open('page2.html','_blank')");
response.write("</script>");

For more info, check here:
http://www.aspsnippets.com/Articles/ASP.Net-Response.Redirect-or-Server.Transfer-Open-new-window.aspx[^]

Good luck!
 
Share this answer
 
v2
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="/KB/answers/page1.aspx" ...
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900