Session is invalid error is driving me nuts!

View: New views
4 Messages — Rating Filter:   Alert me  

Session is invalid error is driving me nuts!

by DURETTE, STEVEN J (ATTASIAIT) :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


All,

 

Ok, this is a little pet peeve of mine.  We have session timeout set and
we tell users that they have to do something within so much time.

 

Problem is the users ignore that.  They open a page with a form, leave
it open for an hour, then when they submit the form Session is invalid
error.  They see a nicely formatted An Error has occurred page, but I
get an email for each one.

 

Any ideas (besides changing the timeout) of what I might do to prevent
this?

 

I have toyed with the idea of locking the form and putting up a message
saying that they timed out. Then they would have to close the
window/tab. Even if they hit refresh it would generate a new session, so
no error.  I'm just not sure of the best way to go about that.  Also,
anything I'd try to figure out should be able to just be cfincluded or
done in Application.cfm/cfc so that I don't have to go through hundreds
of files to solve this one.

 

Thanks,

Steve

 



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Want to reach the ColdFusion community with something they want? Let them know on the House of Fusion mailing lists
Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:328027
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=17837.14401.4

RE: Session is invalid error is driving me nuts!

by Dave Phillips-10 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Steve,

There are a number of ways (probably more than I'm listing here):

1. If you're using Application.cfm, sdd code to it so that if of your
session (say, session.logged_in) is undefined, then it will redirect the
user to a login page.  This way, the 'processing' page for your form never
even gets loaded and the result is no error (just a frustrated user from
having filled out the form and now they will have to do it again)

2. Add a meta tag redirect to your form page that matches your session
timeout.  Although this is a client side redirect, it can accomplish pretty
much the same thing - if there is no activity in the browser for that period
of time, the page redirects to a specified page ("your session has timed
out, click here to login") or something like that.

I would prefer option 1, but others prefer option 2.  There are probably
some other options some may have here on the list as well.

Dave Phillips

-----Original Message-----
From: DURETTE, STEVEN J (ATTASIAIT) [mailto:sd1985@...]
Sent: Wednesday, November 04, 2009 1:02 PM
To: cf-talk
Subject: Session is invalid error is driving me nuts!


All,

 

Ok, this is a little pet peeve of mine.  We have session timeout set and
we tell users that they have to do something within so much time.

 

Problem is the users ignore that.  They open a page with a form, leave
it open for an hour, then when they submit the form Session is invalid
error.  They see a nicely formatted An Error has occurred page, but I
get an email for each one.

 

Any ideas (besides changing the timeout) of what I might do to prevent
this?

 

I have toyed with the idea of locking the form and putting up a message
saying that they timed out. Then they would have to close the
window/tab. Even if they hit refresh it would generate a new session, so
no error.  I'm just not sure of the best way to go about that.  Also,
anything I'd try to figure out should be able to just be cfincluded or
done in Application.cfm/cfc so that I don't have to go through hundreds
of files to solve this one.

 

Thanks,

Steve

 



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Want to reach the ColdFusion community with something they want? Let them know on the House of Fusion mailing lists
Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:328034
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=17837.14401.4

RE: Session is invalid error is driving me nuts!

by Dave Phillips-10 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Oh, I meant to add that if you are using application.cfc instead of .cfm,
then you would put your code to redirect in the OnSessionEnd function.

Dave

-----Original Message-----
From: DURETTE, STEVEN J (ATTASIAIT) [mailto:sd1985@...]
Sent: Wednesday, November 04, 2009 1:02 PM
To: cf-talk
Subject: Session is invalid error is driving me nuts!


All,

 

Ok, this is a little pet peeve of mine.  We have session timeout set and
we tell users that they have to do something within so much time.

 

Problem is the users ignore that.  They open a page with a form, leave
it open for an hour, then when they submit the form Session is invalid
error.  They see a nicely formatted An Error has occurred page, but I
get an email for each one.

 

Any ideas (besides changing the timeout) of what I might do to prevent
this?

 

I have toyed with the idea of locking the form and putting up a message
saying that they timed out. Then they would have to close the
window/tab. Even if they hit refresh it would generate a new session, so
no error.  I'm just not sure of the best way to go about that.  Also,
anything I'd try to figure out should be able to just be cfincluded or
done in Application.cfm/cfc so that I don't have to go through hundreds
of files to solve this one.

 

Thanks,

Steve

 





~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Want to reach the ColdFusion community with something they want? Let them know on the House of Fusion mailing lists
Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:328036
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=17837.14401.4

Re: Session is invalid error is driving me nuts!

by Charles Sheehan-Miles-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


You can't do a redirect .. or any client output... in onsessionend() ...
because that runs when the session is over.

Maybe something like this:

<cffunction name="onrequeststart" blah blah....
  <cfif not IsDefined("session.whatever")>
     <cflocation url="/login...">
 </cfif>

What I do in that instance is check their cookie.  I keep my session lengths
short to preserve memory, but if they have a valid cookie that hasn't
expired, i start the session again right there... by the time the form
submits in the onrequest method, they have a valid session again.  That may
not meet security requirements for some applications however.


On Wed, Nov 4, 2009 at 3:12 PM, Dave Phillips <
experiencedcfdeveloper@...> wrote:

>
> Oh, I meant to add that if you are using application.cfc instead of .cfm,
> then you would put your code to redirect in the OnSessionEnd function.
>
> Dave
>
> -----Original Message-----
> From: DURETTE, STEVEN J (ATTASIAIT) [mailto:sd1985@...]
> Sent: Wednesday, November 04, 2009 1:02 PM
> To: cf-talk
> Subject: Session is invalid error is driving me nuts!
>
>
> All,
>
>
>
> Ok, this is a little pet peeve of mine.  We have session timeout set and
> we tell users that they have to do something within so much time.
>
>
>
> Problem is the users ignore that.  They open a page with a form, leave
> it open for an hour, then when they submit the form Session is invalid
> error.  They see a nicely formatted An Error has occurred page, but I
> get an email for each one.
>
>
>
> Any ideas (besides changing the timeout) of what I might do to prevent
> this?
>
>
>
> I have toyed with the idea of locking the form and putting up a message
> saying that they timed out. Then they would have to close the
> window/tab. Even if they hit refresh it would generate a new session, so
> no error.  I'm just not sure of the best way to go about that.  Also,
> anything I'd try to figure out should be able to just be cfincluded or
> done in Application.cfm/cfc so that I don't have to go through hundreds
> of files to solve this one.
>
>
>
> Thanks,
>
> Steve
>
>
>
>
>
>
>
>

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Want to reach the ColdFusion community with something they want? Let them know on the House of Fusion mailing lists
Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:328044
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=17837.14401.4