0

I'm Working in MVC vb.net with asp.net engine instead of Razor.

I'm returning the file like so

1. Return File(xStream, "application/pdf")

and

2. Return File(xStream, "application/pdf", "NameOfFile.pdf")

In my Asp.net page I call the Report like so

<a id="report" href="<%: Url.Action("report", "Report", New With {.id = Model.reportID})%>" target="_blank">Print</a>

Using the first return from above, i get the stream in the browser -> good, except it's not in a new window.

Using the second return from above, i get the stream as a downloaded file.

How can i change my code to open the pdf report like in return 1, exept in a new window?

EDIT:

recently tried scripting the button to use

window.open('<%: Url.Action("Report", "Report", New With {.id = Model.ReportID})%>','_blank');

however this opens a completely new window, i'd like to have a tab opened.

tereško
  • 58,060
  • 25
  • 98
  • 150
Don Thomas Boyle
  • 3,055
  • 3
  • 32
  • 54
  • Check the browser default, as you can attempt to specify a new windows, but it won't necessarily respect your (developer) choice, if the user (browser) choice is there. Also this is likely a repeat of http://stackoverflow.com/questions/4907843/open-a-url-in-a-new-tab-using-javascript – Gregory A Beamer May 13 '14 at 16:03

1 Answers1

1

do not believe this has changed much. There was a way to force a new window over a new tab by defining other attributes of the window with you opened it ie: size, location but the determining factor as to the pop up being in a new tab or new window is up to the browser/settings.

another similar question

Community
  • 1
  • 1
workabyte
  • 3,496
  • 2
  • 27
  • 35