redirect unauthenticated users from frameset child pages?

G

Guest

Have a frameset HTML page (parent) with child .aspx pages. When each of the
child pages loads, it checks to see if the user is authenticated, and if not,
redirects to the login page:

if(!this.Context.User.Identity.IsAuthenticated)
{
Response.Redirect("Login.aspx",true);
}

The problem is that if I go to the parent page directly, I get four versions
of the login page, each in a different frame. How do I redirect the browser,
not just the frame, to the login page?
 
G

Guest

Should have checked before I posted. Plenty of info about this out there.
My solution was: For each frame page save the header page, I replaced
Response.Redirect with plain ol' Response.End() to prevent anything from
showing from those pages. To the header page, I replaced Response.Redirect
with:

Response.Write("Redirecting to Login.aspx. Click <a
href=\"Login.aspx\">here</a> if this fails.");
Response.Write("<script language='javascript'>top.location.href
=\"Login.aspx\"</script>");
Response.End();

This writes out a javascript line that will redirect the frameset page to
the login page, and if this fails for some reason, leaves an informative
message and link for users.
 
B

Bruce Barker

it would be cleaner to have the frameset page check first.

-- bruce (sqlwork.com)
 
G

Guest

I agree. However, when I added the frameset page, VS added it as a plain
HTML page. Can I convert the frameset page to aspx and use its page_load
event to do this checking? I would prefer to do this, but I'm not sure that
it would work.
 

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

Members online

Forum statistics

Threads
473,995
Messages
2,570,236
Members
46,821
Latest member
AleidaSchi

Latest Threads

Top