Search code examples
c#response.redirectnew-window

Is it possible to add 2 Response.Redirect, one will open in different tab and other one will open in same tab, using C#?


When user will click on button, I want to open one .aspx/.html page in different tab and open one .aspx/.html page in same tab.

Sample code:

string redirect = "<script>window.open('../User/Profile.html');</script>";
Response.Write(redirect);
Response.Redirect("../User/NewUser.aspx",true);

Thanks in Adance!!!


Solution

  • No, the response redirect writes in the http's header the "location" value and can only have one, but you can write a javascript like the next for do what you need:

    window.open('../User/Profile.html', 'tabName');
    window.location.href = '../User/NewUser.aspx';
    

    Good luck!