.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
david stephan
Gaurav Pal
Post New Web Links

Open pdf in a new window

Posted By:      Posted Date: September 15, 2010    Points: 0   Category :ASP.Net
I have written the following code to open up a TIF/PDF file.     FileStream fs = new FileStream(imageUrl, FileMode.Open, FileAccess.Read); MemoryStream ms = new MemoryStream(); copyStream(fs, ms); HttpContext.Current.Response.Clear(); HttpContext.Current.Response.ClearContent(); HttpContext.Current.Response.ClearHeaders(); HttpContext.Current.Response.Buffer = true; HttpContext .Current.Response.BinaryWrite(ms.ToArray()); HttpContext .Current.Response.End();   This will open up the pdf in the same window.But I need it to be opened in a separate window.   Please help. t  

View Complete Post

More Related Resource Links

Open PopUp Window From Error httpModule


I would like to open a popup window from the assembly to present the information to the user. Does anyone know if this is possible, I am presently doing the following:

        WriteLine("body {font-family:""Verdana"";font-weight:normal;font-size: .7em;color:black; background-color:white;}")
        WriteLine("b {font-family:""Verdana"";font-weight:bold;color:black;margin-top: -5px}")
        WriteLine("H1 { font-family:""Verdana"";font-weight:normal;font-size:18pt;color:red }")
        WriteLine("H2 { font-family:""Verdana"";font-weight:normal;font-size:14pt;color:maroon }")
        WriteLine("pre {font-family:""Lucida Console"";font-size: .9em}")

Open a link in new window from a custom fields description MOSS 2007



I have kept a help link (ex: http://www.msdn.com) under a document library field's description. i want this link to be opened in a new window with out navigating from that page.

any ideas greatly appreciated.




Open aspx page in new window or tab



    I use the following code in a Buttons onClick handler.



Is it possible to open the EIQuotationReport.aspx web form in a new window or a new tab? I could change the button to a hyperlink if required.



Open my aspx page in new window....

Hi..On button click im using this Server.Transfer("abc.aspx", true); to transfer to abc page.. what i need is i need to open in new window by this abc.aspx page on button click..here im passing parameter to abc.aspx page, so let me know how to do...so plz let me know how to achieve this....

>>> Open a Popup window on Successful Login if something new added to website.

Hi, I would like to open a Popup window in Parallel if user Login successfully. The popup will give updates to the user that what's new added to the website. The popup will open only once if user login. If he logout and will re-login then it should not popup as we'll assume that he has been notified earlier. I have users table with user id's. It is for information that I am working in Framework 2.0 and not allowed to use any third party or AjaxToolkit. Therefore javascript or any other technique will resolve the issue. Any idea with coding example would be helpful.

Window.Open in AJAX Accordian Panel Opens Link in Same Window

I'm using the following span to open a page in a new window. What is INCREDIBLY odd is that it is exactly the same code from three different pages, but the first refuses to open in a new window. The only difference is that the first example resides within an Ajax Accordian Panel so I suspect that it might be an Ajax related issue. Ideas? Does not open in new window.<span onclick="window.open ('http://[domainname]/Mercury/production/content/directory/DirectorySideBar.aspx','mywindow','width=271,height=498,scrollbars=no');">   Opens in new window<span onclick="window.open ('http://[domainname]/Mercury/production/content/directory/DirectorySideBar.aspx','mywindow','width=271,height=498,scrollbars=no');">   Opens in new window<span onclick="window.open ('http://[domainname]/Mercury/production/content/directory/DirectorySideBar.aspx','mywindow','width=271,height=498,scrollbars=no');">  

how to open 2 different windows from different buttons with window.open or...

Hello, I'm trying to open 2 different windows from different buttons with window.open Do not manage... Annyone  who knows how? I need code xample...   Is it posible to set ID for this window.open ?   Thanks

Links to open new browser window?

I've setup some links on "My Site" and can't seem to figure out how to get them to open the links in a new window. I'd also like to do this for my RSS feed links.(This is in MOSS 2007) Can someone help?

Open a new window in existing window using WPF

Hi All, I'm trying to create a form which may be used as an MDI form. As far as I came to know with that there is no support for MDI form in WPF so is there any other way to fulfill this requirement. All help is welcome.   Thanks in anticipation. 

GridView Select Open New Internet Explorer Window

Hi, I'm wondering if there is a built in way to take a GridView select buttons and have them open an IE window or tab and link a FormView Control to that link.Basically a Master-Details type of view, but in a new window instead of the same window.

Open in new window option for Image Button

I am using an Image Button with onclientclick property set.Upon clicking the button I am able to navigate to URL page. But when I am right clicking on the Image Button I am not getting "Open in new window" or "Open in new tab". These options I see when I right click on an Hyperlink control.Can we achieve the same fro Image Button. If so how?Thank you,Praveen.

How to open new browser window in asp.net mvc

I need open new browser window.

window.open not working in IE 7

Hi All,Window.open is not working in IE 7.It is working fine in fiefox.On doing google it was found that it happens due to space between words in title of window or URL.Even after i removed space between words in window title it is still not working.Any idea or clues would be highly appreciated.thanks in advance for replying(as always).Regards,Manish.

Dynamic Content In A ModalPopupExtender & Open A New Browser Window

Ok, after searching on how to do this and trying many different ways and failing, I finally got something working.  So, I decided to post it here to help anyone else that might be trying to do the same thing.  If anyone sees a better way to do this then please let me know. I want to populate an update panel with addresses so I use a repeater.  I want the user to click a link and that causes a modal popup to appear for the user to enter thier address so that they can get driving directions to the address listed in the Repeater.  I needed a way to get the address the user was driving to, to also be inside the modal popup because I need to pass it along later.  The reason the list of addresses are in an updatepanel are for paging purposes.  I've used a simple version of the repeater in this example though.<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <HTML> <body> <form id="Form1" method="post" runat="server"> <asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager> <asp:UpdatePanel ID="myMainPanel" runat="server" EnableViewState=false> <ContentTemplate> <asp:Repeater ID="rptItems" runat="server" EnableViewState=false> <ItemTemplate>

Button in datalist, open new window with query string

hi everyone,i'm writing a button which need to open a new window and sending binded data as query string:<asp:DataList ID="DataList_Comment" runat="server" DataKeyField="Comment_id" DataSourceID="CommentDataSource" Width="482px"> <ItemTemplate> .... <br /> <input type="hidden" name="comment_id" id="comment_id" value='<%# Eval("Comment_id") %>' /> <input id="Button1" type="button" value="button" onclick="open_win(comment_id.value)" /> </ItemTemplate> </asp:DataList> here is the open_win function:<script type="text/javascript"> function open_win(id) { var url = "Report.aspx?type=comment&id=" + id; window.open(url); } </script> But the url created is ".../Report.aspx?type=comment&id=undefined", the queryString["id"] is not defined.In the calling page source html, comment_id has value.<input type="hidden" name="comment_id" id="comment_id" value='2' /> How can i set the variable value of "comment_id" in button onclick, to call the javascript o

Click imagebutton open window.open in class asp.net 2.0

Click imagebutton open window.open in class asp.net 2.0


Hi all,Here's some simple code<a href='<%= string.Format("../Print/Print1.aspx?withParameter={0}", Para )%>'>HyperLinkText</a>and it works well. so i guess i can write anything like this, so i wrote a test:<input type="button" value="Btn1" onclick='<%= string.Format("window.open('','_blank')") %>'/> <input type="button" value="Btn2" onclick="window.open('','_blank')"/>However, Btn1 does not work.. for some reason i have to NOT to use server control, so i wite it in inline-code style,why the first hyperlink work well, but Btn1 fails?could anyone tell me?thank you~
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend