473,765 Members | 2,066 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Forms Authentication No Cache AND avoiding Web Page Has Expired Ms

I have a site which I secure with forms authentication. When the user's
sign on and hit one of the secure pages, I have this line in my code to
ensure that the browser does not cache the page; and someone cannot navigate
back to an cached image of the page in theory after the user has signed off.

Response.Cache. SetCacheability (HttpCacheabili ty.NoCache);

This works all right, except when the user decides to use the browser's back
button to navigate between a menu page and a web page inside the secure forms
authentication directory; the page they are going back to while they're
logged in in the secure directory gets expired and they get the Web Page Has
Expired Msg.
While they are signed in and in the secure directory I would like them to be
able to go back and forth to the area freely; but I want to destoy the cache
of the pages they visited upon logout or session expiration. Is there a way
to do this? Or to force the browser to reload a page completely when it's
expired?

Aug 15 '08 #1
5 6795
Hello ch************* ***********@dis cu...icros oft.com,

How do u handle session expiration and logout?! do u have special logout
stuff for your webservice and how do you clear session/cache during logout/expiration?!

---
WBR,
Michael Nemtsev [Microsoft MVP] :: blog: http://spaces.live.com/laflour

"The greatest danger for most of us is not that our aim is too high and we
miss it, but that it is too low and we reach it" (c) Michelangelo
cI have a site which I secure with forms authentication. When the
cuser's sign on and hit one of the secure pages, I have this line in
cmy code to ensure that the browser does not cache the page; and
csomeone cannot navigate back to an cached image of the page in theory
cafter the user has signed off.
c>
cResponse.Cache .SetCacheabilit y(HttpCacheabil ity.NoCache);
c>
cThis works all right, except when the user decides to use the
cbrowser's back
cbutton to navigate between a menu page and a web page inside the
csecure forms
cauthentication directory; the page they are going back to while
cthey're
clogged in in the secure directory gets expired and they get the Web
cPage Has
cExpired Msg.
cWhile they are signed in and in the secure directory I would like
cthem to be
cable to go back and forth to the area freely; but I want to destoy
cthe cache
cof the pages they visited upon logout or session expiration. Is
cthere a way
cto do this? Or to force the browser to reload a page completely when
cit's
cexpired?
Aug 15 '08 #2
This is done via a asp login status control-which is a link; when clicked it
fires off the onloggingout event, which calls these two methods:

Session.RemoveA ll();
Session.Abandon ();

There's also the session timeout.

"Michael Nemtsev [MVP]" wrote:
Hello ch************* ***********@dis cu...icros oft.com,

How do u handle session expiration and logout?! do u have special logout
stuff for your webservice and how do you clear session/cache during logout/expiration?!

---
WBR,
Michael Nemtsev [Microsoft MVP] :: blog: http://spaces.live.com/laflour

"The greatest danger for most of us is not that our aim is too high and we
miss it, but that it is too low and we reach it" (c) Michelangelo
cI have a site which I secure with forms authentication. When the
cuser's sign on and hit one of the secure pages, I have this line in
cmy code to ensure that the browser does not cache the page; and
csomeone cannot navigate back to an cached image of the page in theory
cafter the user has signed off.
c>
cResponse.Cache .SetCacheabilit y(HttpCacheabil ity.NoCache);
c>
cThis works all right, except when the user decides to use the
cbrowser's back
cbutton to navigate between a menu page and a web page inside the
csecure forms
cauthentication directory; the page they are going back to while
cthey're
clogged in in the secure directory gets expired and they get the Web
cPage Has
cExpired Msg.
cWhile they are signed in and in the secure directory I would like
cthem to be
cable to go back and forth to the area freely; but I want to destoy
cthe cache
cof the pages they visited upon logout or session expiration. Is
cthere a way
cto do this? Or to force the browser to reload a page completely when
cit's
cexpired?
Aug 15 '08 #3
Hi,

Based on my understanding, what you want to do is use
"Response.Cache .SetCacheabilit y(HttpCacheabil ity.NoCache);" to prevent some
pages from being cached at client-side. And you also want to allow the
cache when the current user has login , but remove the cache after it
logout or session timeout, correct?

If this is the case, I'm afraid it is quite difficult for browser base web
application. That's because the "Response.Cache .SetCacheabilit y
HttpCacheabilit y.NoCache);" just set the http cache header when the page is
flush out. Thus, if you originally enable cache for that page(when the user
is login at that time), you cannot access that cache or remove it from
ASP.NET code later(if the user logout), all the caches are controled by the
client browser since then. IMO, if security is the top priority, the best
approach is still disable caching for all those security sensitive pages
(for both login and logout users). How do you think?

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead
Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
ms****@microsof t.com.

=============== =============== =============== =====
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/en-us/subs...#notifications.

This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
>Thread-Topic: Forms Authentication No Cache AND avoiding Web Page Has
Expire
>thread-index: Acj/IUoHJ1WAnWAoRSW kKjlTao8O7Q==
X-WBNR-Posting-Host: 207.46.19.197
Date: Fri, 15 Aug 2008 14:53:02 -0700
>
This is done via a asp login status control-which is a link; when clicked
it
>fires off the onloggingout event, which calls these two methods:

Session.Remove All();
Session.Abando n();

There's also the session timeout.

"Michael Nemtsev [MVP]" wrote:
>Hello ch************* ***********@dis cu...icros oft.com,

How do u handle session expiration and logout?! do u have special logout
stuff for your webservice and how do you clear session/cache during
logout/expiration?!
>>
---
WBR,
Michael Nemtsev [Microsoft MVP] :: blog: http://spaces.live.com/laflour

"The greatest danger for most of us is not that our aim is too high and
we
>miss it, but that it is too low and we reach it" (c) Michelangelo
Aug 27 '08 #4
Steven,

Thank you for your response.

I have two issues out of this one central issue.

1.) The users complaining that they can't use the browser's back button to
go back to one of these secure pages without seeing "Web Page Has Expired,"
and having to use a specific Back button that I've put on the pages in the
application, which does a response.redire ct to a page and does NOT give them
this message. They want to be able to use the browser's back button and have
the page reload itself. Without getting prompted for a reload, or seeing
some error page in lieu of the real page they're trying to get to.

2.) I don't want the forms authentication pages to be available in cache
after the user has timed out or has logged off, so that some other user using
the same PC can come along and view the "secure" page later without even
logging into the system and have the proper authentication for role.

So it sounds like from your last post this might be difficult to do. Are
there any solutions?

"Steven Cheng [MSFT]" wrote:
Hi,

Based on my understanding, what you want to do is use
"Response.Cache .SetCacheabilit y(HttpCacheabil ity.NoCache);" to prevent some
pages from being cached at client-side. And you also want to allow the
cache when the current user has login , but remove the cache after it
logout or session timeout, correct?

If this is the case, I'm afraid it is quite difficult for browser base web
application. That's because the "Response.Cache .SetCacheabilit y
HttpCacheabilit y.NoCache);" just set the http cache header when the page is
flush out. Thus, if you originally enable cache for that page(when the user
is login at that time), you cannot access that cache or remove it from
ASP.NET code later(if the user logout), all the caches are controled by the
client browser since then. IMO, if security is the top priority, the best
approach is still disable caching for all those security sensitive pages
(for both login and logout users). How do you think?

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead
Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
ms****@microsof t.com.

=============== =============== =============== =====
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/en-us/subs...#notifications.

This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
Thread-Topic: Forms Authentication No Cache AND avoiding Web Page Has
Expire
thread-index: Acj/IUoHJ1WAnWAoRSW kKjlTao8O7Q==
X-WBNR-Posting-Host: 207.46.19.197
Date: Fri, 15 Aug 2008 14:53:02 -0700

This is done via a asp login status control-which is a link; when clicked
it
fires off the onloggingout event, which calls these two methods:

Session.RemoveA ll();
Session.Abandon ();

There's also the session timeout.

"Michael Nemtsev [MVP]" wrote:
Hello ch************* ***********@dis cu...icros oft.com,

How do u handle session expiration and logout?! do u have special logout
stuff for your webservice and how do you clear session/cache during
logout/expiration?!
>
---
WBR,
Michael Nemtsev [Microsoft MVP] :: blog: http://spaces.live.com/laflour

"The greatest danger for most of us is not that our aim is too high and
we
miss it, but that it is too low and we reach it" (c) Michelangelo

Aug 27 '08 #5
Thanks for your reply,

Yes, for the 1) one you mentioned, I'm afraid that's the case. the user has
to revisit the page if the original has got expired. That's the safe
strategy for that case.

Anyway, for expiring a page, we could only determine whether it should be
always un-cached on client-side, but not dynamically cache it or invalidate
its cache on client-side(depend on whether the user is logon or not).

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead

Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
ms****@microsof t.com.

=============== =============== =============== =====
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/en-us/subs...#notifications.

=============== =============== =============== =====
This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
>From: =?Utf-8?B?Y2hlY2tyYWl zZXJAY29tbXVuaX R5Lm5vc3BhbQ==? =
<ch************ ************@di scussions.micro soft.com>
>Subject: Re: Forms Authentication No Cache AND avoiding Web Page Has Expire
Date: Wed, 27 Aug 2008 10:16:10 -0700
>
Steven,

Thank you for your response.

I have two issues out of this one central issue.

1.) The users complaining that they can't use the browser's back button
to
>go back to one of these secure pages without seeing "Web Page Has
Expired,"
>and having to use a specific Back button that I've put on the pages in the
application, which does a response.redire ct to a page and does NOT give
them
>this message. They want to be able to use the browser's back button and
have
>the page reload itself. Without getting prompted for a reload, or seeing
some error page in lieu of the real page they're trying to get to.

2.) I don't want the forms authentication pages to be available in cache
after the user has timed out or has logged off, so that some other user
using
>the same PC can come along and view the "secure" page later without even
logging into the system and have the proper authentication for role.

So it sounds like from your last post this might be difficult to do. Are
there any solutions?

"Steven Cheng [MSFT]" wrote:
>Hi,

Based on my understanding, what you want to do is use
"Response.Cach e.SetCacheabili ty(HttpCacheabi lity.NoCache);" to prevent
some
>pages from being cached at client-side. And you also want to allow the
cache when the current user has login , but remove the cache after it
logout or session timeout, correct?

If this is the case, I'm afraid it is quite difficult for browser base
web
>application. That's because the "Response.Cache .SetCacheabilit y
HttpCacheabili ty.NoCache);" just set the http cache header when the page
is
>flush out. Thus, if you originally enable cache for that page(when the
user
>is login at that time), you cannot access that cache or remove it from
ASP.NET code later(if the user logout), all the caches are controled by
the
>client browser since then. IMO, if security is the top priority, the
best
>approach is still disable caching for all those security sensitive pages
(for both login and logout users). How do you think?

Sincerely,

Steven Cheng

M
Aug 29 '08 #6

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

Similar topics

3
357
by: G-Fit | last post by:
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...
1
2469
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
1570
by: john | last post by:
I have 2 questions: 1. I am trying to use forms authentication. When the user logs out, I make these function calls: Session.Abandon(); FormsAuthentication.SignOut(); But after they log out, the user can (e.g. through the web history) go and look at any pages that were already viewed when the session was going on because of the cache. I don't want them to be able to do
2
386
by: Mike | last post by:
1. For some reason after the session has ended and the authentication cookie has expired I'm not being redirected to the login page. Insted I'm be assigned a new authentication cookie? Anyone have any ideas as to what may be causing this? (I'm using Microsoft's example 2. I'm also transferring a forms authentication cookie recieved from a web service (SQL Reporting Services) thru my app to the client. For some reason the expired cookie is...
3
2362
by: Mike | last post by:
I have a web application that the forms authentication cookie is not expiring correctly. When I look at the trace information of a newly requested page after the session and forms authentication have expired the forms authentication cookie is assigned a new value. I am never redirected to the login page after my initial login. If I access the site from http://localhost/myapp instead of myapp.domain.com the cookies expire correctly. The cookie...
1
2194
by: AVance | last post by:
Hi, I've come across this scenario in ASP.NET 1.1 with forms authentication where the forms auth doesn't seem to timeout correctly, nor redirect to the login page. I have done some testing, and I believe I've found a solution, but I would like some insight from Microsoft on whether the code I've implemented is correct, and why it is even working. Here is my scenario:
14
2097
by: Tom.PesterDELETETHISSS | last post by:
Hi, I think this question requires an in depth understanding of how a browser cache works. I hope I can reach an expert here. I may have found a quirk in the asp.net documentation or I don't understand what the SetAllowResponseInBrowserHistory does. While researching caching I tried the code sample at the following page : http://msdn2.microsoft.com/library/97wcd0a4(en-us,vs.80).aspx
2
1300
by: Mike Hofer | last post by:
Okay, so I finally figured out forms authenticaton, to a degree and I still have one question: If a user walks away from my application, and the cookie expires, and then he comes back, does forms authentication automatically force him back to my logon page? Or does the session just expire? Or does that depend on whether or not the cookie expires before the IIS session? Can someone help me out here?
0
893
by: Anuradha | last post by:
Hi, In web.config authetication tag is like this.... <authentication mode="Forms"> <forms name=".ASPXUSERDEMO" loginUrl="default.aspx" protection="All" timeout="5"> </forms> </authentication>
0
9568
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
10007
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
9959
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
8833
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
6649
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
5277
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
5423
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3926
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
2806
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.