Question:
open a webpage in new window - using C# code?
tom
2008-06-06 18:18:51 UTC
i want to open a webpage when i click on a button and that this page should be open in a new internet explorer window.

in C# code, a page is usually opened through the following code.

Response.Redirect ("pageName.aspx");

but this will open the page in the same window. how can i open it in a new window?

hope my question is clear!
i want something like Response.Redirect ("pageName.aspx", target=_blank);
Four answers:
rollandb1
2008-06-06 18:28:25 UTC
you need to pass any data to the second form and have the second form process the data...

jacquelynn
2016-05-25 02:45:00 UTC
Howdy, to do that you have to use either ShellExecuteEx or CreateProcess because both return an hProcess handle to the newly launched Process which then can be used with TerminateProcess to shut it down. I would be careful with that though because some browsers have multiple tabs or are just one process with more windows. Even destroy window might terminate other browsing sessions. I think the best way to handle this would be to close the desired window/tab with javascript.
warsql
2008-06-06 18:25:24 UTC
Only the client side can open a new window. You can do that in html or javascript. Set a target atrribute on the link.



Link
Nisovin
2008-06-06 18:28:05 UTC
Response.Write( "");

Response.End();



This is probably not a good way to do what you're wanting, but it should work.


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...