Frames and response.redirect

  • Thread starter PKin via DotNetMonster.com
  • Start date
P

PKin via DotNetMonster.com

Hi,
I really need som help here.
I have read a lot of thread about Frames ans response.redirect and I know by
now that I cannot use response redirect and I have to use "some kind of
javascript on the client side" according to a lot of answers. The only
answers that have some code did not seem to work with my code?

I have a login page (with no frame) and when the program accepts the login
the page is redirected to a page with 3 frames. On the header frame there is
a logout button. In the codebehind I am suppose to abandon the session and to
redirect to the Login page (the one with no frames). Here is the code behind
the logout button:


FormsAuthentication.SignOut()
Session.Abandon()
<Here I am suppose to redirect to the login page>

How Can I solve this problem?
Can anybody help me?

Thanks
PKin
 
D

Darren Kopp

I have no idea if this works, but i would think that it would. With that
said, you said that you have to use javascript to change go to wherever it
is you need to go. Couldn't you do something like the following? -

FormsAuthentication.SignOut()
Session.Abandon()
Response.Write(script)

where script would be a string of something like
"<script>window.location.href = bla</script>". (I don't know what the
javascript for the command would be so I doubt what i put would work).

I would think that that would work, but again I don't know for sure. Just
an idea.

-Darren Kopp
http://blog.secudocs.com/
 
C

Chris Botha

This can only be done by using Java script on the client side.

In the page displaying in the header frame do the following:
Up top in the class declare a variable to be used by the Java script,
something like:
Protected m_TargetPageTxt As String = ""
In the postback code of the Logout button, do your stuff, BUT instead of
re-direct, insert the following statement, telling the Java script to
re-direct:
m_TargetPageTxt = "LoginForm.aspx"
Note - use the name of your login form.

In the page itself displaying in the header frame, go into HTML view and
right at the bottom paste this Java script
<script language="javascript">
var TargetPageTxt = '<%=m_TargetPageTxt%>';
if (TargetPageTxt != "") {
window.top.navigate(TargetPageTxt);
}
</script>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Frames and Response.Redirect / Response.Write - Refresh 2
Response.Redirect 2
Response.Redirect 1
Response.Redirect and frames 3
response.redirect 1
Response.Redirect Hangs 5
Frames 1
Response.Redirect problem 4

Members online

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top