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

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

Opening New Browser WIndow

Posted By:      Posted Date: October 11, 2010    Points: 0   Category :ASP.Net

Is it possible to Open a new browser tab/window using c#.  I have query string info I don't want to put in a hidden field due to it showing on the client side.  I do save the data in ViewState and encrypt the viewstate; however, I don't know how to access that information on client side. 

I can access the viewstate data fine on Server Side but I need to open the new browser window on server side in order to access the ViewState.  I may be wrong.  Is there a trick to this? 


I did find a way; however, on any other click after the initial click everything goes to a new window:

:LinkButton OnClick="btnEmployeeGridEdit_Click" ID="lnkEmployeeEdit"

View Complete Post

More Related Resource Links

Browser window is opening up on the second click with javascript code



I am trying to set a javascript code to open up a new browser window with this URL that exists like shown below.

On the first click nothing happens but on the second click the browser window is opening up.


How is it possible to make it open up on the first click ?

                                <asp:ImageButton ID="ImageButton3" runat="server" Height="84px" 
                                    ImageUrl="~/images/1.jpg" Width="165px" 
                                    onclick="ImageButton3_Click" />

    protected void ImageButton3_Click(object sender, ImageClickEventArgs e)
        String openURL = "javascript:window.open('" + "Folder1/testing.aspx" + "');return false;";
        ImageButton3.OnClientClick = openURL;


Response.Redirect in new browser window

   protected void ddlPrint_Changed(object sender, EventArgs e)     {         if (ddlPrint.SelectedValue == "All Agenda Items")         {             Response.Redirect(string.Format("{0}?{1}", SettingsRepository.ReportingURL,                                             Utils.EncryptQueryString("ReportName=AgendaItem.rpt")));         }How can I open following report in new browser window using response.redirect? Thx   protected void ddlPrint_Changed(object sender, EventArgs e)    {        if (ddlPrint.SelectedValue == "All Agenda Items")        {            Response.Redirect(string.Format("{0}?{1}", SettingsRepository.ReportingURL,                                            Utils.EncryptQueryString("ReportName=AgendaItem.rpt")));        }}

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?

How to open new browser window in asp.net mvc

I need open new browser window.

Sub Report in New Browser Window Or a Breadcrumb - WARNING - Non Developer

I successfully created a report with a sub-report. My newest problem is when I click on a sub-report, I want to be able to quickly get back to the top report.  What's best approach besides the "back" button? Is it possible to launch the sub-report in a different browser window?  Or, can I add a breadcrumb to the report itself? TIA

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>

opening a web browser without opening form on windows form load event

Hello All, I have a main frame which has a display button. after clicking on display button I usually open a windows forms. Now I have a requirement to open a web page after clicking on display button. I should not show windows form to the user. for that I had written following code in the Form_int (override) event of windows form. System.Diagnostics.Process.Start(http://www.google.com); and I commented out ShowDisplay(); code.  Everything looks good till now and when I run the project and clicked on display button web browser has been opened, but if I click again another web browser is being opening. but I don't want another browser to be opened. can anybody please help me in that. Thanks in advance.

Open browser window + populate from code behind

Hi,I have a variable, which contains a whole web page. Is there a way to open a new browser window and set the contents of this variable as the page? I don't mind if it's javascript, but it has to be able to hold a bit of data if this is the case.Thanks!

Opening a folder in a new browser

Hi, Developing a web application in C# which stores files in a tree structure in a server.A project ( eg: ABC) has many sub folders (eg: ABC_sub1,ABC_Sub2...etc) . Each sub folder will have many types of files. (Eg: .dat,.txt .... etc)I have stored the project name and the path to the parent folder ( in this case ABC) in a database.Eg: \\sereverName\Test\MyProject\ABCWhat I need to do is when a user selects a given project ( eg; ABC) & clicks the link button component  called "browse"  to open the folder (\\sereverName\Test\MyProject\ABC) in a new window.This is the code I thought would work.protected void LinkButtonFolderBorwse_Click(object sender, EventArgs e)    {        string myPath = @HiddenFieldFolderLocation.Value;        System.Diagnostics.Process prc = new System.Diagnostics.Process();          prc.StartInfo.FileName = myPath;        prc.Start();    }HiddenFieldFolderLocation.Value gets the path of the parent folder (\\sereverName\Test\MyProject\ABC).When I click the link button nothing happens.Any help would be greatly appreciated.Thanks

Copy paste of url in new browser window should take me to Login Page

Hi,            I got one situation that if i paste the url in my current browser window to new browser window iam able to view the related page in new window instead i should redirect to my Login Page, can anyone help please its very much needed for me With Regards, Damodharam B V  

Problem on opening child window on third time



I have a button that having an attributes as follow:

btnAddColumn.Attributes.Add("onClick", "selectDetailColumn('Type1',1); return false");

It will open a child window with the following assignment.

<script language="javascript" type="text/javascript">

        function selectDetailColumn(area, testType) {
            scLeft = (window.screen.availWidth - 600) / 2;
            scTop = (window.screen.availheight - 700) / 2;
            window.open('Details.aspx?, 'PopUp', 'width=600,height=700,top=' + scTop + ',left=' + scLeft + ',toolbars=no,scrollbars=no,status=no,resizable=no');

On this details.aspx, I have button to close the form as below:

<asp:Button ID="btnClose" runat="server" Width="80" Text="Close" OnClientClick="window.close();" />

What I did is when I open the child window, I will click on the Close button. I will repeat this process again. And on the third time I open the child window again, it wont open it, but instead the page "stays loading...".

Seems like the IIS is not responding.

opening new window from code behind using javascript



I am trying to open new window when i click on a button using javascript

Page.ClientScript.RegisterStartupScript(this.GetType(), "openwindow", "window.open('WebForm2.aspx','','height=200,width=300');", true);

this is the code i am using.

But the problem is it postsback whole page.

Can some body tell me how i can open new window without posting back the page.



Closing the browser window before file streaming




I have the following requirement in one of the applications I am working.

In an aspx page, that gets opened in new window from a hyperlink that is clicked in the main application. The newly opened window contains a button and on clicking on that button, an Excel file gets streamed to the user for download. If the file is created successfully for streaming, the newly opened window where the button is there should be closed automatically, otherwise, the window should stay with errror message gets displayed.


Can any one suggest how can this be achieved in ASP.Net?


Thank you,


Opening links from WPF WebBrowser control in default browser instead of IE

I am working on a WPF application that uses System.Windows.Controls.WebBrowser to display an embedded HTML page.
The problem I have is that all links from that page that are to open an external browser window (with target="_blank") open Internet Explorer instead of the configured default browser.
How do I tell the WebBrowser control to respect the default browser settings?

Login problem with existing browser window


Hi All,

We are developing ASP.net 2.0/C# web application.

Once Login is expired the page is redirected to login page automatically. again If I am trying to login with same window, login is not working. Login is working when the application is opened in new browser.

What is the problem and how can i fix that error?

How to open MS word document in browser window?

Hi all

Is it somehow acheivable to open a .doc - document in a browser window?

If I link a .pdf - file from the document library in left navigation menu it opens in a browser window. If I do the same with a MS Word docuemnt it opens the Word application, but I want it to open it inside a browser. Can this somehow be done?


How to close individually the multiple open browser window using c# code?


Hello guys,

The scenario is I have multiple open browser window (IE or Firefox) then I want to close the specific browser individually.

I have tried to lookup the applications running from the task manager but I can't get the running application from the task manager > application > task.

I have added two references below to lookup the task running applications.

using System.Diagnostics;
using System.Threading;

Anyone can help me on how to close individually the specific open browser window using c# code event.


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