Back to list
Views:   153.3K
Replies:  5

ASP.NET Response.Redirect to open a new browser window?

We are using ASP.NET Webforms (not MVC).

My question is this: 
Is it possible to open a new browser window using a postback and then some variety of Response.Redirect?

Hans Overkamp, Apr 03, 2011
Reply 1
This question was posed almost 2 years ago. 
Is there anything new in JavaScript or HTML 5 that makes this possible?

Thank you.
Trey Henlon, Feb 24, 2013
Reply 2

        u try this one!!!!

<asp:Button ID="btnSubmit" runat="server"  Text="Submit" OnClick="btnSubmit_Click" />


protected void btnSubmit_Click(object sender, EventArgs e)
        Response.Write("<script> '../yourpage.aspx' , '-blank' );</script>");
Dhina S, Apr 30, 2012
Reply 3
As mentioned above you can't use Response.Redirect but with JavaScript its possible (as long as js its enabled).

Hope this helps you

//PostBack approch
protected void Button1_Click(object sender, EventArgs e) 
//Consume ParamX 
   ScriptManager.RegisterStartupScript(Page, typeof(Page), "OpenWindow", "'YourPage.aspx?Param=" + ParamX.ToString() + "');",true);
//Page Load approach
protected void Page_Load(object sender, EventArgs e)
    Button1.OnClientClick="'YourPage.aspx?Param=" + ParamX.ToString() + "');"; 

Ricky Owen, Apr 19, 2011
Reply 4
Yeah, without JS this is not possible but with some clever hack you can achieve the desired result.

For detailed information refer this post.

ope this helps.
Rajesh Pillai, Apr 04, 2011
Reply 5
As far as I know, this is not possible to do using Response.Redirect since it is on the server side. Your best bet would probably be to use JavaScript... but that will not work if the user has JavaScriptdisabled.

Good Luck!

Robert Blixt, Apr 04, 2011
Stay Inspired!
Join other developers and designers who have already signed up for our mailing list.
Terms     Privacy     Cookies       Do Not Sell       Licensing      
Made with    in Austin, Texas.  - vsn 44.0.0
© Data & Object Factory, LLC.