473,811 Members | 2,911 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Forms Authentication | session ends | asp.net recycle

Hi Guys

I was wondering if you can help me out with the following problem. I
created a basic secure | non secure website. So I have the root
directory as publically allowable pages and a directory called secure
with one secure page in it. Hence if I access the secure.aspx page
within the secure directory without being authenticaed then I'm thrown
to the login page.

All seems to work well, the problem I encounter is when the asp.net
process recycles or if the session ends. What happens is if I reload
that secure page again then because session object cookie is
independent of the forms authentication cookie, my session data has
expired but my page still thinks I'm authenticated and hence I am not
thrown back to login.aspx.

So my initial thought was to put in the session_start event in
global.asax the following 2 lines:
System.Web.Secu rity.FormsAuthe ntication.SignO ut()
Response.Redire ct("login.aspx" )

The problem with this solution is that public pages will also be
thrown back t the login page every time a new session starts. The only
way I've been able to get something is by checking if a session object
member exists only on secure pages but that seems a hack siince I
would have to include this on every page that needs the check

Basically I want if the session has ended then I would like only
secure pages to be redirected back to the login pages.

Question: How do I know if my page is needs authentication or not so I
can selectively know when to redirect back to the login page? How
could I force the a login page if the session ends but only on secure
pages? What are my alternatives?
Nov 18 '05 #1
0 1365

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

Similar topics

1
2476
by: Scott | last post by:
Hi, We're having an issue with Forms Authentication cookies being treated as expired / invalid, and being deleted. This is causing our intranet users a great deal of pain - Running IIS 5.0 on Win2k Server - Forms Authentication is setup with a timeout value of 45 minutes in web.config - Session timeout is set to 45 minutes in web.config
3
4874
by: Kris van der Mast | last post by:
Hi, I've created a little site for my sports club. In the root folder there are pages that are viewable by every anonymous user but at a certain subfolder my administration pages should be protected by forms authentication. When I create forms authentication at root level it works but when I move my code up to the subfolder I get this error: Server Error in '/TestProjects/FormsAuthenticationTestingArea' Application.
5
1774
by: Kenneth Keeley | last post by:
Hi, I have a web app that has forms authentication and I can login to the page the first time I go there but it never times me out if I come back in 24 hours a hit the refresh key the page loads and I am still logged in. My session details are gone but I am still logged. These are the settings I am using are they right or do I need to change them? <system.web> <authentication mode="Forms">
3
1965
by: DotNetGruven | last post by:
Hi, I'm noticing that if web.config is changed, the web app is restarted and all Sessions are restarted as expected, but with Web Form authentication, it seems like the user is still authenticated. This allows the user to keep on trucking, but without any session state. Adding the following code to Session_Start in global.aspx.cs protected void Session_Start(Object sender, EventArgs e) { if ( User.Identity.IsAuthenticated ) { ...
18
6885
by: Rippo | last post by:
Hi I am using role base forms authentication in asp.net and have come across a problem that I would like advice on. On a successful login a session variable is set to identify a user. This is all good as this session variable is used to retrieve data for that user etc. However if I restart the webserver then the users session is lost but the ticket is still active. Therefore the user is not redirected back to the login page.
7
26351
by: Adrian Parker | last post by:
We have an application that's running ok on most of our customers machines, but on one of them we get an error. They're running on windows 2003 server with iis6. In the web.config, the authentication is set to forms, and the form tag contains: timeout="25" slidingExpiration="true" Event Type: Information Event Source: ASP.NET 2.0.50727.0 Event Category: Web Event Event code: 4005 Event message: Forms authentication failed for the...
1
5731
by: gnewsgroup | last post by:
I am using forms authentication for a web application. Like many other member web application, my web application prints out Welcome! John Doe (Logout) on the top right corner of each protected page. But, pages can still be visited by following the links in the web application after a session has timed out, data can still be retrieved
4
5330
by: Bjorn Sagbakken | last post by:
In a web-application with login creds (user, pwd), these are checked against a user table on a SQL server. On a positive validation I have saved the userID, name, custno and role-settings in a userobject (custom build class) and added this to the session using as session variable like session For all other pages I have added a small test in the page_load event, basically testing if the session != null, but also checking if the...
1
1643
by: Mufasa | last post by:
Folks, This is sort of a continuation of my question with session timeouts but slightly different. I am using Forms authentication with the following code: FormsAuthenticationTicket lTicket = new FormsAuthenticationTicket(lsUserID, true, 6000); // Hash the cookie for transport string lHash = FormsAuthentication.Encrypt(lTicket);
0
9730
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
10651
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10392
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...
0
10136
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
9208
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...
1
7671
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5555
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5693
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3868
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.