Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Response.Redirect to a new window???

Status
Not open for further replies.

canadatct

Programmer
Aug 11, 2003
26
0
0
CA
Is it possible to use Response.Redirect and open a new window?
 
no, or haven't given it that much thought

when I need to open a new window I usually generate the client code via ASP to do so.

eg:
response.write &quot;<script> window.open(&quot;blah.asp&quot;) </script>&quot;



_____________________________________________________________________
onpnt2.gif

 
But what are you gonna do with the current window?

Here is the process.

1. Browser has requested a page from the web server.

2. The web server detects that this is not a page but an ASP script and turns the request over to ASP.

3. ASP looks at the request data and determines that it should request another page, this is the Response.Redirect action. It tells the web server, go get that other page.

4. The web server gets that other page and sends it to the browser.

5. The browser renders the page in the current window.


The web server does not know what window made the request, that is the browser's job.

What you need to do is open the new window first, then request the document you want to fill it with. Use Javascript or the TARGET attribute in a link to create the new window.

If the current document cannot have the data to determine whether a new window is needed, then you could respond with a similar page that has Javascript to open a new window and request the new document. But this does not involve Response.Redirect. The Javascript might go something like this.

Code:
<html>
<body onload='window.open(&quot;wholeNewWorld.asp&quot;,&quot;viewStuff&quot;);
'>

<!- Here is all of the same HTML in the original page -> 

</body>
</html>
 
alrighty then, we need abit more details to get into that far but anyhow............

good post rac2

_____________________________________________________________________
onpnt2.gif

 
Thanks for the replies.

Basically, what I am doing is coding a login process. If the user enters the correct login information, I want to open a new window and redirect them to a different page. If the login fails, I don't want to open a new window. They will then be redirected back to the login page to re-enter their information.

rac2: to answer your question.......the current window will remain as it is. Maybe I have clarified this already with my explanation.

onpnt: I was originally thinking of using Javascript to open the new window, so maybe I will give it a shot. I've never seen how response.redirect could open a page in a new window, so I thought I would check.

Thanks again!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top