473,486 Members | 2,136 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

NoAccessAllowed.aspx

Hi all,

Q1: When running my aspx application in IE, I noticed that the user is still
able to assess the system after the session cookies has expired by clicking
on the BACK AND FORWARD buttons on the browser. I guess this is because the
page is cached by the brower. Is there anyway of preventing this from
happening ? Is it possible to redirect the page to NoAccessAllowed.aspx if
the user clicks the BACK browser button after the session has expired ?

Q2: I was thinking of AUTOMATICALLY redirecting my page ( after the session
has expired) to another page ie. NoAccessAllowed.aspx. Is there a way I can
do this AUTOMATICALLY ?

TIA,
Andrew.
Nov 19 '05 #1
4 1117
Andrew,

We had the same problem...
On each of our pages we do a check to see if the session cookie is
still live and if not we send the user back to the login page.
But if the user clicked the back button they could continue to use the
cached cookie.

The only way I was able to resolve this was when the page loads for the
first time I do something like this

Response.Expires = 60
Response.ExpiresAbsolute = DateAdd(DateInterval.Day, -1, Now())
Response.AddHeader("pragma", "no-cache")
Response.AddHeader("cache-control", "private")
Response.CacheControl = "no-cache"
in the page load event....

This way onc the session cookie expires and the back button is clicked
the user is sent back to the login page.

HTH

Nov 19 '05 #2
Thanks for your reply.
I am not very sure exactly what your code does, but I gather that it
specifies that the page in the cache expires after 60 seconds. Am I right ?
So when the user clicks on the BACK button, there is no longer a page in the
cache, and it will reload from the server, and if the user has NOT been
authenticated, will redirect to userlogin.aspx.

TIA.
Andrew.

"Hawksey" wrote:
Andrew,

We had the same problem...
On each of our pages we do a check to see if the session cookie is
still live and if not we send the user back to the login page.
But if the user clicked the back button they could continue to use the
cached cookie.

The only way I was able to resolve this was when the page loads for the
first time I do something like this

Response.Expires = 60
Response.ExpiresAbsolute = DateAdd(DateInterval.Day, -1, Now())
Response.AddHeader("pragma", "no-cache")
Response.AddHeader("cache-control", "private")
Response.CacheControl = "no-cache"
in the page load event....

This way onc the session cookie expires and the back button is clicked
the user is sent back to the login page.

HTH

Nov 19 '05 #3
(INLINE)

"Andrew" <An****@discussions.microsoft.com> wrote in message
news:85**********************************@microsof t.com...
Hi all,

Q1: When running my aspx application in IE, I noticed that the user is
still
able to assess the system after the session cookies has expired by
clicking
on the BACK AND FORWARD buttons on the browser. I guess this is because
the
page is cached by the brower.
This is correct.
Is there anyway of preventing this from
happening ?
Set a low cache time in your page to ensure it does not cache for long on
their machine. You can use zero if they should not get back to the page
after submit.
Is it possible to redirect the page to NoAccessAllowed.aspx if
the user clicks the BACK browser button after the session has expired ?
How do you know to redirect them? It is their machine, their browser cache
and a cached version of your page. Your server has no clue, at that time,
they exist. You can create a JavaScript mechanism, but it is probably more
trouble than it is worth (unless you can google search and find someone who
has already done the work and left it available for everyone to use).
Q2: I was thinking of AUTOMATICALLY redirecting my page ( after the
session
has expired) to another page ie. NoAccessAllowed.aspx. Is there a way I
can
do this AUTOMATICALLY ?


Yes and no. You can add a meta-refresh tag to your page with the timeout
value for the application. When the page redirects, you ensure
NoAccessAllowed.aspx also kills a session if one still exists (logs them
out); this is a safety measure. You will still need to have short cache
times as back button is still available.

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

***********************************************
Think Outside the Box!
***********************************************
Nov 19 '05 #4
Here is some more information on teh HTTP headers option:
http://aspalliance.com/694

"Andrew" <An****@discussions.microsoft.com> wrote in message
news:85**********************************@microsof t.com...
Hi all,

Q1: When running my aspx application in IE, I noticed that the user is still able to assess the system after the session cookies has expired by clicking on the BACK AND FORWARD buttons on the browser. I guess this is because the page is cached by the brower. Is there anyway of preventing this from
happening ? Is it possible to redirect the page to NoAccessAllowed.aspx if
the user clicks the BACK browser button after the session has expired ?

Q2: I was thinking of AUTOMATICALLY redirecting my page ( after the session has expired) to another page ie. NoAccessAllowed.aspx. Is there a way I can do this AUTOMATICALLY ?

TIA,
Andrew.

Nov 19 '05 #5

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

Similar topics

3
3926
by: Stevie_mac | last post by:
It might be me but... I dont seem to get a Page_Load event when a opening an ASPX in an iFrame. I do geta Page_Load event when an item on the ASPX (inside the iFrame) is clicked but then...
1
2799
by: Jerry Tovar | last post by:
I am using .Net 2003 on a XPPro running IIS. I am unable to view any of my ASPX webforms in a browser unless I modify the .ASPX file and replace Codebehind="employee.aspx.cs" with...
3
9831
by: Tom | last post by:
Hi, I have an index.aspx page which includes top.aspx, left.aspx, main.aspx and bottom.aspx. In the left.aspx, there is a login web control - login.ascx. It keeps session of username and role...
6
3554
by: John Lau | last post by:
Hi, I am looking at the MS KB Article 306355: HOW TO: Create Custom Error Reporting Pages in ASP.NET by Using Visual C# .NET This article describes how to redirect errors to a custom html...
3
1826
by: DavidS | last post by:
Have parent.aspx from which I open Driver.aspx form via button on parent.aspx. When I first open the modal dialog, the driver.aspx Page_Load function is called. After I close the dialog, then...
3
2702
by: Evan | last post by:
I have a web page with 2 frames. The left frame is running menu.aspx and the right frame is running images.aspx. When a selection is made in menu.aspx I call a method in images.aspx and pass a...
2
1991
by: WJ | last post by:
I have three ASPX pages: 1. "WebForm1.aspx" is interactive, responsible for calling a web site (https://www.payMe.com) with $$$. It is working fine. 2. "WebForm2.aspx" is non-interactive, a...
10
2412
by: ptass | last post by:
Hi In asp.net 2.0 an aspx files .cs file is a partial class and all works fine, however, I thought I’d be able to create another class file, call it a partial class and have that compile and...
24
2723
by: John Rivers | last post by:
ASPX which means ASPX pages, the code-behind concept, User Controls, Web Controls etc. is very poorly designed and makes it extremely hard to develop professional quality web applications. ASPX...
0
7100
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,...
0
6964
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7126
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,...
0
7175
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...
0
7330
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...
1
4865
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...
0
4559
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...
0
1378
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 ...
0
262
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...

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.