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 <
[email protected]> 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:[email protected]]
> 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=89.70.4