Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Response.Redirect w/targets

Posted on 2002-05-11
10
Medium Priority
?
1,603 Views
Last Modified: 2007-11-27
I have a web site that allows users to log in.  Every page accessed checks to ensure their session is still valid.  If it isn't it's supposed to redirect them back to the login page.  Problem is, the site starts out as a single page, then, upon login Redirects people to a frameset page.  So if any one of the frameset pages redirects the user, the login window would appear in the frameset.

How can I redirect to "_parent"?
0
Comment
Question by:Lee W, MVP
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 4
10 Comments
 
LVL 33

Expert Comment

by:hongjun
ID: 7004119
Redirect to _parent? This can be solved using JavaScript.

<script language="JavaScript">
    window.open "your_page.asp";
</script>

hongjun
0
 
LVL 96

Author Comment

by:Lee W, MVP
ID: 7004128
I don't know JavaScript much at all.  Please provide the code I would use.

Figure, as of now, every page uses an "include" file that says:

<%
IF SESSION("ACTIVE") <> "TRUE" THEN
   RESPONSE.REDIRECT("login.asp")
END IF
%>
0
 
LVL 33

Expert Comment

by:hongjun
ID: 7004133
Below example code will open login.asp with target="_parent".


<%
IF SESSION("ACTIVE") <> "TRUE" THEN
%>
<script language="JavaScript">
   window.open "your_page.asp";
</script>
<%
END IF
%>


hongjun
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
LVL 33

Accepted Solution

by:
hongjun earned 140 total points
ID: 7004136
Should be this

<%
IF SESSION("ACTIVE") <> "TRUE" THEN
%>
<script language="JavaScript">
  window.open "login.asp";
</script>
<%
END IF
%>


hongjun
0
 
LVL 96

Author Comment

by:Lee W, MVP
ID: 7004714
That opens a new window.  I don't want a new window, I want the PARENT of the frameset to be the window that gets the login window.  Basically, I want to cancel the frameset and go back to the login page.  
0
 
LVL 96

Author Comment

by:Lee W, MVP
ID: 7004729
The only reason I'm accepting this as an answer is because you said to use javascript.

The apparently correct way to do it is:

<%
IF SESSION("ACTIVE") <> "TRUE" THEN
%>
     if (document.images)
          location.replace("http://www.somesite.com/index.asp");
     else
          location.href = "index.asp";
     //--></SCRIPT>
<%
END IF
%>

I found the above sample on www.irt.org - They seem to have an extensive FAQ about javascript and other web related stuff...
0
 
LVL 96

Author Comment

by:Lee W, MVP
ID: 7004731
I missed a line - to clarify for anyone else who wants the answer:


<%
IF SESSION("ACTIVE") <> "TRUE" THEN
%>
<SCRIPT LANGUAGE="JavaScript">
    <!--
    if (document.images)
         location.replace("http://www.somesite.com/index.asp");
    else
         location.href = "index.asp";
    //-->
</SCRIPT>
<%
END IF
%>
0
 
LVL 33

Expert Comment

by:hongjun
ID: 7005640
Why a C grade here? You request for code to do target="_parent" and I gave you. Perhaps you should rephrase your question. This is misleading.

hongjun
0
 
LVL 96

Author Comment

by:Lee W, MVP
ID: 7006345
Because it didn't work... I tried your code and it opened a new window - an effective "target=_blank", it did not load the page in the _parent window.

I'll clarify. I have one browser window.   I open frame based web page.  20 minutes later, the session expires.  Currently, my code (which I realized doesn't work) redirects the current frame to the login page.  Essentially the same as the ASP code I first posted.  Your code opens a new browser window, leaving the old one there - NOT what I wanted.  I want to stay with the 1 browser window and basically load a non-frames page to tell the user to re-login.  If you can provide a better answer, I'll see if I can't get this answer grade changed.
0
 

Expert Comment

by:daveabad
ID: 7531555
This is the technique I use....

<%
if session("seclevel") < 2 then
  session.abandon
  response.write "<html><body onload='top.location='/'></body></html>"
else
  'happy auth'ed user stuffs
end if
%>

0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I was asked about the differences between classic ASP and ASP.NET, so let me put them down here, for reference: Let's make the introductions... Classic ASP was launched by Microsoft in 1998 and dynamically generate web pages upon user interact…
This demonstration started out as a follow up to some recently posted questions on the subject of logging in: http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_28634665.html and http://www.experts-exchange.com/Programming/…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…

609 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question