473,772 Members | 3,672 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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
FormsAuthentica tion.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 2368
Some code provided in case it can help understand what I'm doing :

in Web.config :
<authenticati on mode="Forms">

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

</authentication>

in my login.aspx codebehind :

HttpCookie cookie = new HttpCookie(".Fa F_userid");

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

cookie.Expires = DateTime.Now.Ad dHours(8);

Response.Cookie s.Add(cookie);

FormsAuthentica tion.RedirectFr omLoginPage (txtLogin.Text, true);
Jul 21 '05 #2
Hi G-Fit,

From your description, you are using the FormsAuthentica tion 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="javas cript">
function goTopFrame()
{
if(window != window.top)
{
window.top.loca tion.href = window.location .href;
}
}
</script>
</head>

Then, use in the body's onload:

<body onload="goTopFr ame()" >

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.m icrosoft.com> a écrit dans le message
de news:1g******** ******@cpmsftng xa06.phx.gbl...
Hi G-Fit,

From your description, you are using the FormsAuthentica tion 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="javas cript">
function goTopFrame()
{
if(window != window.top)
{
window.top.loca tion.href = window.location .href;
}
}
</script>
</head>

Then, use in the body's onload:

<body onload="goTopFr ame()" >

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
2867
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 frame instead of redirecting to the login page by itself. Why doesn't it redirect completely to the login page.
2
1622
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 shows login page. Is there any way out to show login page in whole page and not in each individual frames. Else if there any event which is called when the authentication cookie expires. Thanks,
0
1284
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 frame. How do I get round this? Thanks, Charles
1
2093
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 test project it is only triggered the first time, it really sucks pretty bad) I started looking at alternatives and I found FormsAuthentication. I just implemened it and it seems very nice. But, of course, there is a problem with it (it wouldn't...
0
1533
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 demonstrates both in the same web.config and I don't like assuming i've done this correctly and securely. Please take a look at the following from my web.config and let me know what you think(its not the full config-- just stripped down to its...
2
2883
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 the login page, and the frameset doesn't appear until after he's logged in However, when the user's login session times out and he subsequently tries to work in one of the frames (i.e. clicks a link). that individual frame
4
2501
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
1449
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 by authenticated users. I've implemented forms authentication (with application in folder A) in a standard way. I've also set up a redirection in IIS so that every request concerning folder B (for example GET /B/a/b/c) is redirected to...
0
2130
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 frameset, the url is rewritten to something of the form 'http://www.blah.com/framesdoc.aspx?lowerFrame=/page.aspx', the 'framesdoc' page then dynamically generates the src attribute for the
2
3750
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 page do NOT appear in any of the web forms located in my Secure dir, however, any forms off the root of my web app will display the master page with the graphics. Is there some trick to get master pages to work with forms authentication of forms...
0
9620
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10104
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10038
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9912
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8934
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6715
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5482
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4007
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2850
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.