By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
428,583 Members | 594 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 428,583 IT Pros & Developers. It's quick & easy.

Using global callback function with cache object

P: n/a
NWx
Hi,

I' trying to implement a callback method when a cache object expires
I want to do this to automatically logout user after a timeout (for demo
purposes)

My thought is, when user logon, create a cache object which expires after,
let's say, 15 minutes, and in that moment, to direct user to a page telling
the time to run demo app was expired.

I found an example on how to do this, but it involves working on the same
page, because the callback function is declared as private void in the page
who register the cache object.

Can I do this, using a shared function instead a private one?

What I want it to execute the callback method no matter what page user is
in, when timeout expires.

Regards
Nov 18 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
You're definitely trying to use the wrong tool. Just create an encrypted
cookie with the users expiration time and log them out once their time
expires. Forms authentication can do this for you automatically. Cache is
not the right object to do this with (your object can get released at any
time, if you understand how the Cache object works you would know that).

Jerry

"NWx" <te**@test.com> wrote in message
news:uF**************@TK2MSFTNGP10.phx.gbl...
Hi,

I' trying to implement a callback method when a cache object expires
I want to do this to automatically logout user after a timeout (for demo
purposes)

My thought is, when user logon, create a cache object which expires after,
let's say, 15 minutes, and in that moment, to direct user to a page telling the time to run demo app was expired.

I found an example on how to do this, but it involves working on the same
page, because the callback function is declared as private void in the page who register the cache object.

Can I do this, using a shared function instead a private one?

What I want it to execute the callback method no matter what page user is
in, when timeout expires.

Regards

Nov 18 '05 #2

P: n/a
NWx
Hi,

Thanks for reply
Actually I used an approach like this, not with the cookie, but with a cache
object
I created a cache object which stores the date/time when the user must be
logged off
In my header Custom control's Load event, I check that object against
current datetime, and logoff when necessary.

My thought about callback from cache was to logoff EXACTLY when time was
expired (because with current approach, if user don't load another page for
a longer time, he won't be logged off)

Regards

"Jerry III" <je******@hotmail.com> wrote in message
news:OJ**************@TK2MSFTNGP12.phx.gbl...
You're definitely trying to use the wrong tool. Just create an encrypted
cookie with the users expiration time and log them out once their time
expires. Forms authentication can do this for you automatically. Cache is
not the right object to do this with (your object can get released at any
time, if you understand how the Cache object works you would know that).

Jerry

"NWx" <te**@test.com> wrote in message
news:uF**************@TK2MSFTNGP10.phx.gbl...
Hi,

I' trying to implement a callback method when a cache object expires
I want to do this to automatically logout user after a timeout (for demo
purposes)

My thought is, when user logon, create a cache object which expires after, let's say, 15 minutes, and in that moment, to direct user to a page

telling
the time to run demo app was expired.

I found an example on how to do this, but it involves working on the same page, because the callback function is declared as private void in the

page
who register the cache object.

Can I do this, using a shared function instead a private one?

What I want it to execute the callback method no matter what page user is in, when timeout expires.

Regards


Nov 18 '05 #3

P: n/a
Since you're cross-posting this into the asp group I assume you're talking
about a web application. There is no such thing as logoff in a web
application, HTTP is a stateless protocol. You cannot logoff user at a
certain time since you, as a server, cannot do anything but react to users
requests. If the user does not send a request there's nothing you can do.

As for using the Cache object for this - why would you want to logoff users
when you run low on memory (because that's when the Cache will start
releasing objects no matter what their expiration time)? It makes absolutely
no sense to use Cache here (or think that you can control the client from a
web application).

Jerry

"NWx" <te**@test.com> wrote in message
news:u4**************@tk2msftngp13.phx.gbl...
Hi,

Thanks for reply
Actually I used an approach like this, not with the cookie, but with a cache object
I created a cache object which stores the date/time when the user must be
logged off
In my header Custom control's Load event, I check that object against
current datetime, and logoff when necessary.

My thought about callback from cache was to logoff EXACTLY when time was
expired (because with current approach, if user don't load another page for a longer time, he won't be logged off)

Regards

"Jerry III" <je******@hotmail.com> wrote in message
news:OJ**************@TK2MSFTNGP12.phx.gbl...
You're definitely trying to use the wrong tool. Just create an encrypted
cookie with the users expiration time and log them out once their time
expires. Forms authentication can do this for you automatically. Cache is
not the right object to do this with (your object can get released at any time, if you understand how the Cache object works you would know that).

Jerry

"NWx" <te**@test.com> wrote in message
news:uF**************@TK2MSFTNGP10.phx.gbl...
Hi,

I' trying to implement a callback method when a cache object expires
I want to do this to automatically logout user after a timeout (for demo purposes)

My thought is, when user logon, create a cache object which expires

after, let's say, 15 minutes, and in that moment, to direct user to a page

telling
the time to run demo app was expired.

I found an example on how to do this, but it involves working on the same page, because the callback function is declared as private void in the

page
who register the cache object.

Can I do this, using a shared function instead a private one?

What I want it to execute the callback method no matter what page user is in, when timeout expires.

Regards



Nov 18 '05 #4

P: n/a
"Jerry III" <je******@hotmail.com> wrote in
news:eT**************@TK2MSFTNGP10.phx.gbl:
talking about a web application. There is no such thing as logoff in a
web application, HTTP is a stateless protocol. You cannot logoff user at


True - but when you use the session object in ASP.net, it does have an
expiration. And if you know the user is done you should use its Abandon
method.

--
Chad Z. Hower (a.k.a. Kudzu) - http://www.hower.org/Kudzu/
"Programming is an art form that fights back"
Nov 18 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.