Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 635
  • Last Modified:

FormsAuthentication.RedirectToLoginPage shows login screen only on the upper frame

Hello,

I am writing a c# asp.net application.
I am using 'authentication' and 'authorization' methods.
I have a framset and i just added a "logout" button to the upper frame.
The problem is that when I press 'Logout' button on the upper frame, The login screen appears on the upper frame only, while I want it to appear on the whole screen.

what I actually do is:
FormsAuthentication.SignOut();
FormsAuthentication.RedirectToLoginPage();


How do I do show the login page on the whole screen?

thank you...
0
Relegence
Asked:
Relegence
  • 6
  • 5
1 Solution
 
LeeKowalkowskiCommented:
So you want to leave the frameset?  You're logout button ought to be a form:

<form action="/logout" method="post" target="_top">
  <input type="submit" value="Logout">
</form>

...with taget="_top", you'll be instructing the browser to load the response into the main window.

--
Lee
0
 
RelegenceAuthor Commented:
Thanks but there is still a problem - The login screen is now displayed in the main window, which is great, but after i enter my credentials and call:

FormsAuthentication.RedirectFromLoginPage(UserName, false);
To automatically redirect the user to the start screen, The header (the upper frame) has become the start screen and it is displayed all over the screen. What actually hapens is that the original URL to redirect to is now the header, instead of my start page.

0
 
LeeKowalkowskiCommented:
Hmm, so your frameset should always be present? What is the state of the frameset the first time you see the login page in your application?

Perhaps the target should not be "_top", but the name of the other frame in the set.

Otherwise you'll need to tell us what your frameset looks like and how your frames interact.

--
Lee
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
RelegenceAuthor Commented:
When I changed the target to the lower frmae, after login again, The header appered in the lower frame, which is not good.
The problem is that the browser thinks that the "return url" (to go to after login) is "header.aspx"

The frameset is built from 2 frames:

The upper farme - 'header' is the name and 'header.aspx' is the src
The lower farme - 'main' is the name and 'main.aspx' is the src

The logout button is located in the header frame
0
 
LeeKowalkowskiCommented:
So where is the login form and what does its frameset look like?  (The first time into the application).  

Perhaps instead of going to header.aspx, you should reload the entire frameset?
0
 
RelegenceAuthor Commented:
The login form is a page (login.aspx) which is opened on the whole screen, first time the user enters the application. The user is redirected to that page by using authentication method:

<authentication mode="Forms">
      <forms name="WDCookie" loginUrl="Login.aspx" path="/" protection="All" timeout="120">
      </forms>
    </authentication>
0
 
LeeKowalkowskiCommented:
So, the first time you log in it works, but if you logout (target="_top") and log back in, you just get header.aspx by itself?

Where does redirection take you to the first time you log in?

--
Lee
0
 
RelegenceAuthor Commented:
Yes, That is the situation, but I do understand why it happens (i just don't know how to change it).
First time I call "Start.aspx" but because I am using the authentication mechanism, i am first, redirected to the login page, and after login i am redirected to the page I've asked originally (start.aspx).

Now, when I press logout, which is located in header.aspx page, I am redirected to the login page, like before. But, this time, the page I am redurected to is header.aspx and not start.aspx.
Header.aspx is my "original URL" now and that is why I am redirected back to it.
0
 
LeeKowalkowskiCommented:
Perhaps you shouldn't RedirectToLoginPage() but redirect to "Start.aspx" explicitly.  Then the authentication mechanism can automatically intercept and redirect to the login page itself and then proceed to Start.aspx.  Which I assume contains your frameset.

--
Lee
0
 
RelegenceAuthor Commented:
Great idea. That works perfectly :-)
0
 
LeeKowalkowskiCommented:
Cool!
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

  • 6
  • 5
Tackle projects and never again get stuck behind a technical roadblock.
Join Now