Link to home
Start Free TrialLog in
Avatar of judsonmusic
judsonmusicFlag for United States of America

asked on

Response.Redirect to an iframe???? Target?????

i have this code
<%Response.Redirect("thankyou.htm")%>
it opens a blank window, where i need it to display the thankyou pafe in an iframe

How do I show a target???

Thanks
Avatar of BrianGEFF719
BrianGEFF719
Flag of United States of America image

Hi judsonmusic,

<%
 response.write("<iframe src=" & chr(34) & "thankyou.html" & chr(34) & " width=100 height=100></iframe>")
%>

-Brian
Avatar of judsonmusic

ASKER

ok, let me rephrase.

I have a main page, with an iframe already on it.
The normal way is simply target="iframe"

I have to use an asp because os the response.redirect.

Is that what your code will do is I replace mine with it???

Thanks

Judson
here is the current code:

MM_redirectLoginSuccess="members.asp"

i need the members page to open in an iframe called iframe

Thanks
Judson
the simplest way would be to put the response.redirect into the page you are already loading in the current iframe.
How would that work???

A user is basically submitting an asp form for login, once it is sucessful I want the page to open in a iframe not a new window.

MM_redirectLoginSuccess="members.asp"

If my code has this?????????????????? above

How can i change the "members.asp" part to load in an iframe that already exists????????????
like target="iframe"



Avatar of Rajesh Dalmia
You cannot use target in response.redirect as it is server side code where as frames and windows are client-side concepts. You have to some JavaScript code to achive what you want.
Check below posts, hope it will help

http://www.developersdex.com/gurus/code/647.asp
http://classicasp.aspfaq.com/forms/how-do-i-change-the-target-frame-or-window-of-a-response-redirect.html


rdonline1
does your page already have an iframe in it?
what page is in the already existing iframe?
Yes, I have a parent page with and iframe in it.

Very simple setup
>>
Comment from kevp75
Date: 12/11/2006 09:20AM EST
 Your Comment  


what page is in the already existing iframe?
<<
The main page points to a page called news.asp in the ifame

When you go to the website you se news in the iframe as default.

I want to when a user logs in on the main page, that it opens the members.asp page in the iframe, not in a new window.

How do I target the iframe in asp???

Judson
PUT THE REDIRECT IN news.asp, based on the session or cookie variable if the user is logged in
What will that do??????

Can you show me the code??????? Please  be specific.
yes that will do...actually, if you still want the news.asp page to be able to be displayed, then you'll have to do things a bit different;y.

on news.asp put

<%
if request.querystring("redir") = "mem" then
    response.redirect("members.asp")
end if
%>


in your login page after your login processing code put:
<%
response.redirect("/thepagethathasyouriframeonit.asp?redir=mem")
%>
ok, Ill try that tonight and get back to you.

thanks

Judson

Can you explaiun each line and how the page in the iframe sees it??

Also can you rewrite the code based on my main page being: mainpage.asp

And my new.asp page being loaded in the iframe by deafault??????

The iframe is calle "iframe""

Thanks for your help in advance,

Judson
You will have somewhere

Response.Redirect MM_redirectLoginSuccess

Change that to

Response.Write "<script>top.frames['IFrameNameHere'].location.href = '" & MM_redirectLoginSuccess &"';</script>"

Make sure to change IFrameNameHere to whatever name you have.
amit, that dos not work for some reason.

Can you be more specific????

here is what I am replacing

MM_redirectLoginSuccess="members.asp"

the iframe is called iframe
I also found this:


Response.Redirect(MM_redirectLoginSuccess)

can you tell me what to do??? I've tried everything~
Line

MM_redirectLoginSuccess="members.asp"

should remain as it is.

Change

Response.Redirect(MM_redirectLoginSuccess)

to

Response.Write "<script>top.frames[0].location.href = '" & MM_redirectLoginSuccess &"';</script>"
That doesnt work either.
The login is on the mainpage.
I want when they login to open the members page in the iframe.


where in the above code does it list my iframe?????? again the name of it is "iframe"

Thanks
>>where in the above code does it list my iframe

I did not get that. What happens when the login button is pressed and login is successful?
with the existing code, it opens the members.asp page new window. I want it to post the members.asp page in the iframe


With your code, it says this page cannot be displayed in a new window.
how can I make it point to my iframe???
You will have to show more code. There are several ways this could happen. If you generated code with DW, you probably have target set. Find out the form tags that has your login submit button. It would look like

<form ... target="_blank">

change that to

<form ... target="iframe">

if that doesn't work for you, show us the complete code of login page.
This is the line of code that I need to change:

MM_redirectLoginSuccess="members.asp"

It works just fine useing the log in user function in dreamweaver. However, it is opening the page in a whole new window.

I want to tell it to open in an iframe.


here is the login code.

here is the login user script. Again, keep in mind there is a content ifram in the middle of the page called "iframe"

------------------------------------------------------------------------------------------------------------------------------------------------------------------

<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<!--#include file="Connections/IBSDatabase.asp" -->
<%
' *** Validate request to log in to this site.
MM_LoginAction = Request.ServerVariables("URL")
If Request.QueryString<>"" Then MM_LoginAction = MM_LoginAction + "?" + Server.HTMLEncode(Request.QueryString)
MM_valUsername=CStr(Request.Form("username"))
If MM_valUsername <> "" Then
  MM_fldUserAuthorization=""
  MM_redirectLoginSuccess="members.asp"//////////////////////////////////////////////This is the problem./////////////////////////////////////////////////////////////
  MM_redirectLoginFailed="sorry.asp"
  MM_flag="ADODB.Recordset"
  set MM_rsUser = Server.CreateObject(MM_flag)
  MM_rsUser.ActiveConnection = MM_IBSDatabase_STRING
  MM_rsUser.Source = "SELECT username, password"
  If MM_fldUserAuthorization <> "" Then MM_rsUser.Source = MM_rsUser.Source & "," & MM_fldUserAuthorization
  MM_rsUser.Source = MM_rsUser.Source & " FROM ibsinfo.IBS_MEMBERS WHERE username='" & Replace(MM_valUsername,"'","''") &"' AND password='" & Replace(Request.Form("password"),"'","''") & "'"
  MM_rsUser.CursorType = 0
  MM_rsUser.CursorLocation = 2
  MM_rsUser.LockType = 3
  MM_rsUser.Open
  If Not MM_rsUser.EOF Or Not MM_rsUser.BOF Then
    ' username and password match - this is a valid user
    Session("MM_Username") = MM_valUsername
    If (MM_fldUserAuthorization <> "") Then
      Session("MM_UserAuthorization") = CStr(MM_rsUser.Fields.Item(MM_fldUserAuthorization).Value)
    Else
      Session("MM_UserAuthorization") = ""
    End If
    if CStr(Request.QueryString("accessdenied")) <> "" And false Then
      MM_redirectLoginSuccess = Request.QueryString("accessdenied")
    End If
    MM_rsUser.Close
    Response.Redirect(MM_redirectLoginSuccess)//////////////////////////////////////////////////////This line tells it to do the above "members.asp"/////////////////////
  End If                                                                                                            //////////////////////////but noe in an iframe currently. how do I fix that???///
  MM_rsUser.Close
  Response.Redirect(MM_redirectLoginFailed)
End If
%>
This is all server side code. Do you have another page where login/password input boxes are? If so post that code. The new window is opened before this code is executed in the server side so we need to make changes in the code that opens the new window. This code doesn't open the new window.
Ummmmm, where would that code be????????


Are you saying there is some code in there that I dont know about????

Where would dreamweaver place it by default????


I am confused.


This is my form:

<form ACTION="<%=MM_LoginAction%>" method="POST" name="form1">
             <p><strong>Quick Login</strong><br>
             username<input name="username" type="text" id="username" size="14"><br>             
          password<input name="password" type="password" id="password" size="14">
          <br>
          <input type="submit" name="Submit" value="Login">
</form>


Nithing else on the whole page has anything to do with this .
When I execute this code on a page inside of the iframe, It works perfectly. It opens the members page.

go to this site:

www.ibsinfo.net

Go to signup, make an test account

The login that doesnt work is on the left.

However, If you go to member login, you can log in with the test account in the iframe and it does work.

Now what???? They both are using the same code.



OK, I FOUND A WAY BUT THERE IS ONE PROBLEM!!!!!!!!!!!!!!!!!!!!!!!!!!!1


I put target="iframe" in the form tag.


the problem is that the username and password sticks in the form boxes, how can I make this refresh?????


Judson


also, if there is indeed an asp work around, I would liek to know it.


Judson
ok, I tried this but it refreshes the iframe too.

I would love to know a solution.....
I figured it out.

<body OnLoad="window.parent.document.forms[0].reset()">


Thsi works fine.


I will give you a c for your help as apposed to a refund.

Thanks

Judson
Actually after looking through the posts, none of it was even close. Im sorry.

Judson
Refund is fine with me.
Thanks for your understanding .
ASKER CERTIFIED SOLUTION
Avatar of RomMod
RomMod

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial