473,386 Members | 1,820 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Forms authentication & frames

Hello group,

I use Forms Authentication in an intranet website. This website has a
framed default.aspx page : one left frame for a menu, one right frame for
the content. The menu depends on the authentication (i.e. each user won't
see the same menu) : for this, I use another cookie (let's call it the
user_id cookie).
If a user identifies him/herself, closes the browser, and comes back
after the authentication cookie has expired, he is redirected to the login
page. Fine.
On session start, I check if the user_id cookie exists and if it is not
expired (without this the menu would fail to build). Otherwise, I do a
FormsAuthentication.SignOut(). And here comes the problem : the login page
appears in the left frame, instead of taking all the page. My login page
being larger than the frame, the result is awful.
Any idea on what I could do to force the login page to appear 'normally'
?

Karine Proot
G-Fit
Jul 21 '05 #1
3 2325
Some code provided in case it can help understand what I'm doing :

in Web.config :
<authentication mode="Forms">

<forms name=".FaF_login" loginUrl="login.aspx" protection="All" timeout="30"
path="/" />

</authentication>

in my login.aspx codebehind :

HttpCookie cookie = new HttpCookie(".FaF_userid");

cookie.Value = reader["CTC_ID"].ToString();

cookie.Expires = DateTime.Now.AddHours(8);

Response.Cookies.Add(cookie);

FormsAuthentication.RedirectFromLoginPage (txtLogin.Text, true);
Jul 21 '05 #2
Hi G-Fit,

From your description, you are using the FormsAuthentication and the web
application is frame based. When the user's authentcation token has expired
and be redirected to the login page. The login page sometimes occur in the
left frame rather than the top frame which maked the whole page very ugly.
So you're wondering how to make the login page display in the top leve
frame no matter what the original location it's located , yes?

I've also occured such problem before and my solution is to use a client
script block in the "login.aspx" page to detect whether the login page is
at the top frame. And execute the script when at the client side's onload
event. For example, in the login page we put the below function in <head>
area:

.....
<script language="javascript">
function goTopFrame()
{
if(window != window.top)
{
window.top.location.href = window.location.href;
}
}
</script>
</head>

Then, use in the body's onload:

<body onload="goTopFrame()" >

Thus, when the login page is loaded it'll detect whether it is located in
the top window. if not, set the top window's location as the login page.
How do you think of this?

Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Get Preview at ASP.NET whidbey
http://msdn.microsoft.com/asp.net/whidbey/default.aspx

Jul 21 '05 #3
Hi Steven,

Thanks a lot for your solution, which works great. I'm sorry as this was not
dotnet-related and only needed a bit of javascript, thank you for taking
your time answering me.
Karine

"Steven Cheng[MSFT]" <v-******@online.microsoft.com> a écrit dans le message
de news:1g**************@cpmsftngxa06.phx.gbl...
Hi G-Fit,

From your description, you are using the FormsAuthentication and the web
application is frame based. When the user's authentcation token has expired and be redirected to the login page. The login page sometimes occur in the
left frame rather than the top frame which maked the whole page very ugly.
So you're wondering how to make the login page display in the top leve
frame no matter what the original location it's located , yes?

I've also occured such problem before and my solution is to use a client
script block in the "login.aspx" page to detect whether the login page is
at the top frame. And execute the script when at the client side's onload
event. For example, in the login page we put the below function in <head>
area:

....
<script language="javascript">
function goTopFrame()
{
if(window != window.top)
{
window.top.location.href = window.location.href;
}
}
</script>
</head>

Then, use in the body's onload:

<body onload="goTopFrame()" >

Thus, when the login page is loaded it'll detect whether it is located in
the top window. if not, set the top window's location as the login page.
How do you think of this?

Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Get Preview at ASP.NET whidbey
http://msdn.microsoft.com/asp.net/whidbey/default.aspx

Jul 21 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Billy Jacobs | last post by:
I have a web application which is using Forms Authentication. The main page of the site is a frames page. If I type in the url to the frames page, it loads the login page inside of the main...
2
by: sushi | last post by:
Hello, I have an web site which uses forms authentication. The application uses frames. When the authentication time out occurs and if we click on any one of the frames, each individual pages...
0
by: Charles Rumbold | last post by:
I am using Forms Authentication and Frames. FA doesn't cover HTML files, only ASP files. If a user goes direct to a frame (e.g. from a bookmark) then the frame opens with a logon window in each...
1
by: Martin | last post by:
Hi, After I gave up on tracking user sessions through the session object (Session_OnEnd is still not triggered by Abandon() even with mode=InProc and me manipulating session variables; in a new...
0
by: Chris Mohan | last post by:
Hi, I've configured a web app to use windows authentication and also set up two separate subdirectories to use forms authentication. It appears to work fine but I have never seen a sample that...
2
by: Andy Fish | last post by:
Hi, I have a problem using forms based authentication with a frameset. I made sure the containing frameset is an aspx so the first time the user tries to access the application he just gets...
4
by: Lewis Edward Moten III | last post by:
I have a file that users can download through a web page protected by forms authentication: Download.aspx?ID=45 and within that file ... FileInfo fileToDownload = new FileInfo(fileName);
0
by: Grzegorz Kaczor | last post by:
Hello, I have an ASP.NET application in my website in virtual folder A. This folder contains the application itself. I also have a data virtual directory B which contains data that can be seen...
0
by: Lee | last post by:
Hi all ;) Preamble -------- I'm using URL rewriting to enforce a frames policy (yeah, I know frames are 'bad' :) - i.e. if a request comes in for a page which should be nested within a...
2
by: Rob R. Ainscough | last post by:
I'm using forms authentication along with Master pages -- my authenticated forms reside is a sub-dir (Secure) below the web site root dir. The problem is that any graphics placed on the Master...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.