473,545 Members | 2,081 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Using global callback function with cache object

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
4 1659
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.co m> wrote in message
news:uF******** ******@TK2MSFTN GP10.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
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******@hotma il.com> wrote in message
news:OJ******** ******@TK2MSFTN GP12.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.co m> wrote in message
news:uF******** ******@TK2MSFTN GP10.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
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.co m> wrote in message
news:u4******** ******@tk2msftn gp13.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******@hotma il.com> wrote in message
news:OJ******** ******@TK2MSFTN GP12.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.co m> wrote in message
news:uF******** ******@TK2MSFTN GP10.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
"Jerry III" <je******@hotma il.com> wrote in
news:eT******** ******@TK2MSFTN GP10.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/
"Programmin g is an art form that fights back"
Nov 18 '05 #5

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

Similar topics

6
4114
by: Stanley | last post by:
has anyone managed to use cache application block in a web application? thanks stanley
4
4078
by: Jim Douglas | last post by:
Ok, I'm must be an dummy, there are tons of examples which none of which I can get to work! I want to setup and refresh about (10) different cache items. Most examples show this type of work being completed in the global.asax but I can't get it to work. I move the code to a C# class, call it from a webpage and it works fine. Am I trying to...
2
4258
by: napawlm | last post by:
Is there a way to "pass" an XMLHttpRequest object to the callback function for onreadystatechange? Or a way to access it from onreadystatechange? I would like to avoid the use of a global variable... Example: /* How do I get rid of this global variable? */ xmlHttp = new XMLHttpRequest();
0
3916
by: Lokkju | last post by:
I am pretty much lost here - I am trying to create a managed c++ wrapper for this dll, so that I can use it from c#/vb.net, however, it does not conform to any standard style of coding I have seen. It is almost like it is trying to implement it's own COM interfaces... below is the header, and a link to the dll+code: Zip file with header,...
35
2256
by: eyoung | last post by:
I call a function that takes the unit price and quantity ordered to create an amount...it looks something like this. function calculateCost() { quantity=document.RFO.quantity.value; unitPrice=document.RFO.unitPrice.value; total=0; if(isPositiveInteger(quantity)) {
22
2031
by: Daniel Rucareanu | last post by:
I have the following script: function Test(){} Test.F = function(){} Test.F.FF = function(){} Test.F.FF.FFF = function(){} Test.F.FF.FFF.FFFF = function(){} //var alias = function(){}; var alias = Test.F.FF.FFF.FFFF;
1
1356
by: an | last post by:
I've implemented a call-back function to repopulate the stored Cache objects when they expires or are removed it works great but in one situation only it doesen't work (that is the callback is not fired): when,
6
7654
by: smmk25 | last post by:
Before I state the problem, I just want to let the readers know, I am knew to C++\CLI and interop so please forgive any newbie questions. I have a huge C library which I want to be able to use in a .NET application and thus am looking into writing a managed C++ wrapper for in vs2005. Furthermore, this library has many callback hooks which...
3
1755
by: dizzy | last post by:
Hi I wonder if this code is standard conformant and should work on all conformant implementations (for some type T): 1: void* mem = ::operator new(sizeof(T)); 2: T* p = new(mem) T(args...); 3: delete p; line 2 I know it should be fine because global operator new should return
0
7473
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...
0
7408
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7661
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. ...
0
7815
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...
1
7433
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...
0
4949
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...
0
3444
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1891
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
1
1020
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.