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

 
100   96.6
Apr 03, 2011
 
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?

Thanks.



1,128   99.9
Apr 04, 2011
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!


1,364   100.0
Apr 04, 2011
Yeah, without JS this is not possible but with some clever hack you can achieve the desired result.

For detailed information refer this post.

http://weblogs.asp.net/infinitiesloop/archive/2007/09/25/response-redirect-into-a-new-window-with-extension-methods.aspx

H
ope this helps.
 1 comment
 
my problem resolved ,tnx --- Harota H  Jul 29, 2012

70   95.9
Apr 19, 2011
As mentioned above you can't use Response.Redirect but with JavaScript its possible (as long as js its enabled).

Hope this helps you
Ricky

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

 

50   50
Apr 30, 2012
hi

        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>window.open( '../yourpage.aspx' , '-blank' );</script>");
    }

72   96.0
Feb 24, 2013
This question was posed almost 2 years ago. 
Is there anything new in JavaScript or HTML 5 that makes this possible?

Thank you.