Open .pdf file in new browser Tab ASP.NET -


i have function named stampasingola:

private sub stampasingola()         dim rpt new rptlettera         ctype(rpt.datasource, sqldbdatasource).sql = "select * vwlettere idlettera in (" & request.querystring("idlettera") & ")"      rpt.run(false)      if not rpt nothing         dim exp new pdfexport         ' create new memory stream hold pdf output         dim memstream new system.io.memorystream         ' export report pdf:         exp.export(rpt.document, memstream)         exp.dispose()         exp = nothing          me.context.response             .buffer = true             .contenttype = "application/pdf"             .addheader("content-disposition", "attachment; filename=archilet_lettera_" & request.querystring("idlettera") & ".pdf;")             .binarywrite(memstream.toarray)             .flush()             .end()         end          rpt.document.dispose()         rpt.dispose()         rpt = nothing     end if end sub 

how make open pdf in new browser tab? thank you

  • create new page downloading "download.aspx"
  • move code page_load event in "download.aspx" page.
  • on button_click event of first page put following code :

protected void btndownload_click(object sender, eventargs e) { response.write(string.format("window.open('{0}','_blank');", "download.aspx")); }


Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

javascript - Get parameter of GET request -

javascript - Twitter Bootstrap - how to add some more margin between tooltip popup and element -