473,756 Members | 1,799 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Session

Hello,
On the LogOut Page i have done Session.Abandon ();
And on every Page, In the Page_Load Event i check if the session exists
and only then display data.
Now the problem is after i logout from application and click the back
button of Internet Explorer, the page displays. Can anyone guide me
plsssss.

Thank you,
Bhagya

Dec 8 '06 #1
6 2807
This is such a common problem.

The problem is, when you click the Back button, your browser gets the page
from its cache. Worse than that, it means that no page_load event is
generated.

The choices you have are pretty limited (AFAIK). You can either try to
disable the Back button, by clearing the browser cache or something, or you
can deal with the problem when it genuinely arises. The former is really
annoying to users.

If you think about it, the problem is not that the page displays, but that
the user then moves on from that page and expects that data to be as
displayed in the browser. Because the session has been cleared, this will
not be the case. What you need to do, therefore, is to check the state of
the application when the user clicks on whatever action control you have
that deals with the application's state - usually a submit or "next" button.
You should be able to check the application's consistency at this point and,
if the application data is not consistent (i.e. you detect, implicitly, that
the user used the browser back button or the session timed out or whatever)
you can display a message or throw an exception or redirect to the login
page or do whatever is reasonable in your program.

This works for us. We make it easier for ourselves by maintaining
application-specific objects that hold the application state. All we put in
the Session are references to these objects. Storing tonnes of data in an
unstructured way in the Session is a really bad idea IMHO. We also use
forms authentication and attributes to ensure that users who are not logged
in and/or do not have the required role(s) cannot access classes and/or
methods innappropriatel y. We usually decorate every Page class, and every
method that alters the application state. In the case you mention, we would
have used FormsAuthentica tion.SignOut() and Session.Abandon (): therefore the
user would fail the security challenge on the Submit or Next button event
handler, because the event handler would be decorated with the appropriate
attributes.

HTH
Peter
"Bhagya" <ja**********@g mail.comwrote in message
news:11******** **************@ 16g2000cwy.goog legroups.com...
Hello,
On the LogOut Page i have done Session.Abandon ();
And on every Page, In the Page_Load Event i check if the session exists
and only then display data.
Now the problem is after i logout from application and click the back
button of Internet Explorer, the page displays. Can anyone guide me
plsssss.

Thank you,
Bhagya

Dec 8 '06 #2

Peter Bradley wrote:
This is such a common problem.

The problem is, when you click the Back button, your browser gets the page
from its cache. Worse than that, it means that no page_load event is
generated.

The choices you have are pretty limited (AFAIK). You can either try to
disable the Back button, by clearing the browser cache or something, or you
can deal with the problem when it genuinely arises. The former is really
annoying to users.

If you think about it, the problem is not that the page displays, but that
the user then moves on from that page and expects that data to be as
displayed in the browser. Because the session has been cleared, this will
not be the case. What you need to do, therefore, is to check the state of
the application when the user clicks on whatever action control you have
that deals with the application's state - usually a submit or "next" button.
You should be able to check the application's consistency at this point and,
if the application data is not consistent (i.e. you detect, implicitly, that
the user used the browser back button or the session timed out or whatever)
you can display a message or throw an exception or redirect to the login
page or do whatever is reasonable in your program.

This works for us. We make it easier for ourselves by maintaining
application-specific objects that hold the application state. All we put in
the Session are references to these objects. Storing tonnes of data in an
unstructured way in the Session is a really bad idea IMHO. We also use
forms authentication and attributes to ensure that users who are not logged
in and/or do not have the required role(s) cannot access classes and/or
methods innappropriatel y. We usually decorate every Page class, and every
method that alters the application state. In the case you mention, we would
have used FormsAuthentica tion.SignOut() and Session.Abandon (): therefore the
user would fail the security challenge on the Submit or Next button event
handler, because the event handler would be decorated with the appropriate
attributes.

HTH
Peter
"Bhagya" <ja**********@g mail.comwrote in message
news:11******** **************@ 16g2000cwy.goog legroups.com...
Hello,
On the LogOut Page i have done Session.Abandon ();
And on every Page, In the Page_Load Event i check if the session exists
and only then display data.
Now the problem is after i logout from application and click the back
button of Internet Explorer, the page displays. Can anyone guide me
plsssss.

Thank you,
Bhagya

Hello,

I m extremely new to this field. Could u give a code snippet or some
example?

Dec 8 '06 #3

Peter Bradley wrote:
This is such a common problem.

The problem is, when you click the Back button, your browser gets the page
from its cache. Worse than that, it means that no page_load event is
generated.

The choices you have are pretty limited (AFAIK). You can either try to
disable the Back button, by clearing the browser cache or something, or you
can deal with the problem when it genuinely arises. The former is really
annoying to users.

If you think about it, the problem is not that the page displays, but that
the user then moves on from that page and expects that data to be as
displayed in the browser. Because the session has been cleared, this will
not be the case. What you need to do, therefore, is to check the state of
the application when the user clicks on whatever action control you have
that deals with the application's state - usually a submit or "next" button.
You should be able to check the application's consistency at this point and,
if the application data is not consistent (i.e. you detect, implicitly, that
the user used the browser back button or the session timed out or whatever)
you can display a message or throw an exception or redirect to the login
page or do whatever is reasonable in your program.

This works for us. We make it easier for ourselves by maintaining
application-specific objects that hold the application state. All we put in
the Session are references to these objects. Storing tonnes of data in an
unstructured way in the Session is a really bad idea IMHO. We also use
forms authentication and attributes to ensure that users who are not logged
in and/or do not have the required role(s) cannot access classes and/or
methods innappropriatel y. We usually decorate every Page class, and every
method that alters the application state. In the case you mention, we would
have used FormsAuthentica tion.SignOut() and Session.Abandon (): therefore the
user would fail the security challenge on the Submit or Next button event
handler, because the event handler would be decorated with the appropriate
attributes.

HTH
Peter
"Bhagya" <ja**********@g mail.comwrote in message
news:11******** **************@ 16g2000cwy.goog legroups.com...
Hello,
On the LogOut Page i have done Session.Abandon ();
And on every Page, In the Page_Load Event i check if the session exists
and only then display data.
Now the problem is after i logout from application and click the back
button of Internet Explorer, the page displays. Can anyone guide me
plsssss.

Thank you,
Bhagya

Hello,

I m extremely new to this field. Could u give a code snippet or some
example?

Dec 8 '06 #4

Peter Bradley wrote:
This is such a common problem.

The problem is, when you click the Back button, your browser gets the page
from its cache. Worse than that, it means that no page_load event is
generated.

The choices you have are pretty limited (AFAIK). You can either try to
disable the Back button, by clearing the browser cache or something, or you
can deal with the problem when it genuinely arises. The former is really
annoying to users.

If you think about it, the problem is not that the page displays, but that
the user then moves on from that page and expects that data to be as
displayed in the browser. Because the session has been cleared, this will
not be the case. What you need to do, therefore, is to check the state of
the application when the user clicks on whatever action control you have
that deals with the application's state - usually a submit or "next" button.
You should be able to check the application's consistency at this point and,
if the application data is not consistent (i.e. you detect, implicitly, that
the user used the browser back button or the session timed out or whatever)
you can display a message or throw an exception or redirect to the login
page or do whatever is reasonable in your program.

This works for us. We make it easier for ourselves by maintaining
application-specific objects that hold the application state. All we put in
the Session are references to these objects. Storing tonnes of data in an
unstructured way in the Session is a really bad idea IMHO. We also use
forms authentication and attributes to ensure that users who are not logged
in and/or do not have the required role(s) cannot access classes and/or
methods innappropriatel y. We usually decorate every Page class, and every
method that alters the application state. In the case you mention, we would
have used FormsAuthentica tion.SignOut() and Session.Abandon (): therefore the
user would fail the security challenge on the Submit or Next button event
handler, because the event handler would be decorated with the appropriate
attributes.

HTH
Peter
"Bhagya" <ja**********@g mail.comwrote in message
news:11******** **************@ 16g2000cwy.goog legroups.com...
Hello,
On the LogOut Page i have done Session.Abandon ();
And on every Page, In the Page_Load Event i check if the session exists
and only then display data.
Now the problem is after i logout from application and click the back
button of Internet Explorer, the page displays. Can anyone guide me
plsssss.

Thank you,
Bhagya

Hello,

I m extremely new to this field. Could u give a code snippet or some
example?

Dec 8 '06 #5
"Bhagya" <ja**********@g mail.comwrote in message
news:11******** **************@ f1g2000cwa.goog legroups.com...
I m extremely new to this field. Could u give a code snippet or some
example?
There's a problem with your newsreader - it keeps duplicating your posts...
Dec 8 '06 #6
Visual Studio Help has the following:

PrincipalPermis sionAttribute can be used to declaratively demand that users
running your code belong to a specified role or have been authenticated. Use
of Unrestricted creates a PrincipalPermis sion with Authenticated set to true
and Name and Role set to a null reference (Nothing in Visual Basic).

The scope of the declaration that is allowed depends on the SecurityAction
that is used. PrincipalPermis sionAttribute cannot be applied at the assembly
level.

The security information declared by a security attribute is stored in the
metadata of the attribute target and is accessed by the system at run time.
Security attributes are used only for declarative security. For imperative
security, use the corresponding permission class.

Important Prior to a demand for principal permission it is necessary to
set the current application domain's principal policy to the enumeration
value WindowsPrincipa l. By default, the principal policy is set to
Unauthenticated Principal. If you do not set the principal policy to
WindowsPrincipa l, a demand for principal permission will fail. The following
code should be executed before the principal permission is demanded:
AppDomain.Curre ntDomain.SetPri ncipalPolicy(Pr incipalPolicy.W indowsPrincipal ).

Example
The following example demonstrates how PrincipalPermis sion can be used
declaratively to demand that the current user is Bob and belongs to the
Supervisor role.

....

C#
[PrincipalPermis sionAttribute(S ecurityAction.D emand, Name="Bob",
Role="Superviso r")]

....

The following example demonstrates how to demand that the current user's
identity is Bob, regardless of role membership.

....

C#
[PrincipalPermis sionAttribute(S ecurityAction.D emand, Name="Bob")]

....

The following example demonstrates how to demand only that the user is
authenticated.

....

C#
[PrincipalPermis sionAttribute(S ecurityAction.D emand, Authenticated=t rue)]

-------------------------------------

If you need help on creating classes and objects, just read any standard
text. But in brief, let's say your UML (or whatever you use) determines
that you have a "Student" class that has interesting state transitions (e.g.
Enquirer --Applicant --Registered-Student --Graduate --Alumnus).
You define your class and then create an instance in your code. In order to
hold onto the instance across ASP.NET event handlers, methods and pages, you
store a reference to the class in the Session:

Student student = new Student();
Session["student"] = student;

Now, in a different scope (new page etc), you can do:

Student s = Session["student"];

Now you can call methods on your student object.

HTH
Peter
"Bhagya" <ja**********@g mail.comwrote in message
news:11******** *************@j 44g2000cwa.goog legroups.com...
>
Peter Bradley wrote:
>This is such a common problem.

The problem is, when you click the Back button, your browser gets the
page
from its cache. Worse than that, it means that no page_load event is
generated.

The choices you have are pretty limited (AFAIK). You can either try to
disable the Back button, by clearing the browser cache or something, or
you
can deal with the problem when it genuinely arises. The former is really
annoying to users.

If you think about it, the problem is not that the page displays, but
that
the user then moves on from that page and expects that data to be as
displayed in the browser. Because the session has been cleared, this
will
not be the case. What you need to do, therefore, is to check the state
of
the application when the user clicks on whatever action control you have
that deals with the application's state - usually a submit or "next"
button.
You should be able to check the application's consistency at this point
and,
if the application data is not consistent (i.e. you detect, implicitly,
that
the user used the browser back button or the session timed out or
whatever)
you can display a message or throw an exception or redirect to the login
page or do whatever is reasonable in your program.

This works for us. We make it easier for ourselves by maintaining
application-specific objects that hold the application state. All we put
in
the Session are references to these objects. Storing tonnes of data in
an
unstructured way in the Session is a really bad idea IMHO. We also use
forms authentication and attributes to ensure that users who are not
logged
in and/or do not have the required role(s) cannot access classes and/or
methods innappropriatel y. We usually decorate every Page class, and
every
method that alters the application state. In the case you mention, we
would
have used FormsAuthentica tion.SignOut() and Session.Abandon (): therefore
the
user would fail the security challenge on the Submit or Next button event
handler, because the event handler would be decorated with the
appropriate
attributes.

HTH
Peter
"Bhagya" <ja**********@g mail.comwrote in message
news:11******* *************** @16g2000cwy.goo glegroups.com.. .
Hello,
On the LogOut Page i have done Session.Abandon ();
And on every Page, In the Page_Load Event i check if the session exists
and only then display data.
Now the problem is after i logout from application and click the back
button of Internet Explorer, the page displays. Can anyone guide me
plsssss.

Thank you,
Bhagya


Hello,

I m extremely new to this field. Could u give a code snippet or some
example?

Dec 8 '06 #7

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

Similar topics

2
3309
by: Damien | last post by:
Hi to all, I'm currently re-designing our intranet : nice and lean CSS2, cleaned-up PHP 4.3.7, better-normalized MySQL ;o). So I've started using the $_SESSION variable instead of register_globals and a couple "better pratice" code. Not perfect, but better. Problem : I'm testing everything with Firefox on my machine (IIS on WinXP Pro), and everything is ok. As soon as I try MS IE 6, it doesn't seem to keep the sessions from page to...
1
4375
by: mudge | last post by:
I'm running PHP Version 4.3.10. I'm trying to make it so that when a person logs in using a user name and password that their session is valid and continues for a few months so they don't have to log in each time they come to the site. In a .htaccess file I set session.cookie_lifetime to 20736000 seconds and I set session.gc_maxlifetime to 20736000 It works for about 30 minutes. A user can login and then close their browser and then...
6
2389
by: Al Jones | last post by:
This is a repost form the vbscript newgroup - if this isn't the appropriate group would you point me toward one that is. Basically, I seem to be losing session data part way though preparing an email from (possibly) three seperate forms. the following code is the end of a routine which stashes data from the first form off to session variables and then redirects itself to the proper form / procedure depending upon the state of two...
5
2455
by: Abhilash.k.m | last post by:
This is regarding the session management using Out of proc session management(SQL SERVER). Among the samples below which one is better to set the session? 1. There are 20 session variables and all of them are being stored into session and accessed from session and individual session object. Example: Session = "XYZ", Session=100, Session="NAME", etc.
0
3239
by: joseph conrad | last post by:
Hi, I tried to implement my own session handler in order to keep control on the process the drawback I foun it is not creating and storing in my cookie the PHPSESSID variable anymore. reading te documentation it seems it should do it anyway any advice?
14
2381
by: aroraamit81 | last post by:
Hi, I am facing a trouble. I have some Session variables in my code and somehow my session variables are getting mixed up with other users. For example User A has access to 10 companies and User B has access to 5, now when both of us hits to the server at the same time then their session variables gets mixedup means either User A and USer B will have now 5 companies or both have 10 companies. Now again when User A hits to the server...
7
3967
by: aroraamit81 | last post by:
Well Guys, Here is a very strange trouble. When more than one users request tto same page at the same time then our session gets conflicted. Moreover I printed my SessionID, strangely but true I got the exact same SessionID as of other users's. Well I guess nothing wrong with my code, do I need to set any property in Web.Config file??
0
2479
by: TRB_NV | last post by:
I'd been using an Access database based shopping cart, but wanted to change it so that it would use session variables. I have a form that's submitted to a page called addtocart.asp that contains the following information: intProdID -- ProductID strProdName -- Product Name intQuant -- Quantity intProdPrice -- Price productType -- Type of product (ie. Wine, Cheese, etc...)
1
2603
by: Santosh | last post by:
Dear All i am writting a code sending mail with attachement. i am writting code for sending mail in one page and code for attaching a file in the next page. aftet attaching a file i am taking name of that file from attaching file page to email page through in session file .i am giving a facility of attaching five files to user . and i am taking names of both files in session variables but user attach less than five five
5
2435
by: lyealain | last post by:
<% If Session("username") = "" Then Response.Redirect("/CLS/Login.asp") End If Dim conn Dim connectstr Dim db_name, db_username, db_userpassword Dim db_server Dim res
0
9462
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
10046
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
9886
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
8723
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
7259
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
6542
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
5155
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
5318
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3369
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.