Form Timeout functionality???


Userlevel 3
Badge +16

Hi,

 

Is it possible to set a timeout on a K2 Smartform?

 

I've been asked if its possible to set a 1 hour timeout on a form. If a form is not completed within 1 hour, log the user off.

 

Is this possible?

 

Or Is it possible to close the web browser window containing the form?

Is it possible to send a pop-up to the screen before closing the Form window if no activity for 1 hour?

 

Thanks,


18 replies

Userlevel 5
Badge +16

hi sharpharp1,

 

What do you mean by "a form is not completed within 1 hour"?  attempts to execute a request or the user doing nothing on the form? 

 

 

If I understood you well, you mean sessionstate timeout

 

Session state is disabled by default, to activate it you'll have to go to:

 

program files (x86) > K2 blackpear > K2 Smartforms Runtime > Web.config 

 

Find:

 

<sessionState mode="Off" />

 

Change mode to On

 

Find:

 

<forms defaultUrl="Default.aspx" loginUrl="Login.aspx" requireSSL="false" enableCrossAppRedirects="true" cookieless="AutoDetect" timeout="9000" />

Change timeout value to 3600 (an hour)

 

Answering your second question:

 

I don't think it's possible to show a pop-up to the user if no activiy for one hour, you can use the timer control and give it interval time for one hour and on its tick event show pop-up msg to the user but you can't guarantee that the user started his activity at the last second, it this case you can't close the form, we can't monitor the user if he's active or not.

 

so I guess you can try the first suggetion 

Userlevel 3
Badge +16

Hiya Mustafa,

 

Yes i basically mean the session times out, I don't want to execute the form, just lose anything entered on it.

 

But the suggestion you made, will that affect ALL forms, as it looks like a config file tweak.

 

I have been asked to do this JUST for ONE form.

Userlevel 5
Badge +16

Hi Sharpharp1,

 

 

I want you to try the following please:

 

add two timer control on the form

 

first timer properties:

interval 3 600 000(1 hour)

infinite interval count

 

Second timer properties:

interval 120000 (2min)

infinite interval count

 

the rules should be like:

 

when the first timer ticked

start the second timer

get confirmation from user (do you want to continue?)

stop second timer

 

 

the other rule on the second time is to close the form, so it will be like

 

when the second timer ticked

 

close the form


I didnt try this solution, I wish you try it and let me know how it goes

this is the only solution i can think of

Note: if there is any initialize method for the second timer on the form initialize rule, Disable it please

wish it helps

 

Userlevel 3
Badge +16

Hi Mustafa,

 

Thanks, I will give that a try and report back.

 

Can i ask if you know what the DEFAULT timeout is for K2 smartforms?

I got some more info from the customer, they said that if users access the form externally from say a PC at home, they are worried that the customer might leave the PC logged in with the form open in a browser and someone else could access it. So they asked if the K2 smartform has a timeout?

 

Is there such a thing built-in for K2 forms, if not accessed (where you have log/authenticate into the form from an external PC) for sometime, then timeout and ask the user to re-login due to inactivity....???

 

If there is, then i wouldn't need to use timers etc?

 

Thanks,

Userlevel 5
Badge +16

Hi sharpharp1,

 

why I suggested to use timres? because you want to apply this approach on one form only and I blieve  there is no other way to do what you want or log out the user without applying it on all forms.

 

the default timeout is two hours and a half 

 

Im not very good at accessing smartforms from external PCs (out of the domain). I guess you'll have to change the authintication from Windows to Form authintication 

 

so when session state ends, the user has to log in again

Userlevel 3
Badge +16

Hi Mustafa.

 

Yes i understand you are offering the solution so it works PER form - and I will definitely try that.

 

I was just asking the question about about the default timeout for ALL forms - which you confirmed as 2.5 Hours.

 

I looked in my IIS K2 Runtime setup, and its set to Windows Authentication, so does the 2.5 Hours Timeout still apply for all forms when using Windows Authentication?

 

Thanks as allows, just need to know the defaults for all forms before i do the individual form timer suggestion you offered.

 

Kind Regards

Userlevel 5
Badge +16

Hi sharpharp1,

 

 it doesn't apply for windows auth

 

check the following please:

 

Anonymous Access/Connect As Application PoolNo timeouts are experienced since all connections are made in the context of the Application Pool Identity user
Windows AuthenticationNo timeouts are experienced as the browser automatically uses NTML or Kerberos to re-authenticate the user
Forms AuthenticationThe user is redirected to the login screen after the session has expired and the current form is lost (standard ASP.NET)
Claims-based AuthenticationThe behavior is controlled by the WIF configuration – usually the user is passively redirected to re-authenticate either using windows credentials or a Forms based login. The current Form may be lost if the re-authentication redirects the user back to the root of the web site (in some cases the user can just continue working)

 

Userlevel 3
Badge +16

So in that case, because I use Windows authentication, there is no timeout....

 

I have no choice but to try the timer solution you mentioned, is that right?

Userlevel 5
Badge +16

Hi sharpharp1,

 

Yes, or change your auth mode if it's possible 

Userlevel 3
Badge +16

Hi Mustafa,

 

I'm just trying the Timer rules.

 

Can you explain the rules.

 

In K2 Designer, does Timer 1 need to set to enabled and Time 2 set to not enabled?

 

Here is what is set in Designer (for testing) Timer1  120 000 ENABLED and Timer2  60 000 NOT ENABLED ...... Is that right?

 

Also here is rule for timer 1

 

13497i546AD55DDEF8CC89.jpg

 

When i run this, i get an IE pop saying "The webpage you are viewing is trying to close the tab. Do you want to close this tab? Yes No (this is IE not K2)

 

If i do not answer and leave it, then a minute later, i get the K2 user confirmation saying "Form Timeout approaching, Do you want to continue...

 

So it's not working quite right.

Also when IE is wanting to close, its gives its own pop-up. Is there a way to force the IE tab to close without it's own "do you want to close" Pop-up message?

 

Userlevel 5
Badge +16

Hi sharpharp1,

 

let me try the solution and i'll get back to you very soon

Userlevel 5
Badge +16

Hi sharpharp1,

 

this confirmation message is mostly from IE and you are not using the timer events it self

 

I have attached a 100% working solution, deploy it and have a look at the rules 

 

it will show a message in 10 seconds and if you don't confirm the message in 5 seconds it will close the browser

 

try it on chrome first, then go to IE check if you still receive same pop up

 

Im trying to find what causes this pop up for you

 

 

Userlevel 3
Badge +16

Getting this error when trying to deploy:

 

13220iF5796C0AEDDFFF12.jpg

Userlevel 5
Badge +16

Hi sharpharp1,

 

We don't have the same version K2 Blackpearl, any way check the following images:

 

first timer properties:

 

16280iD93918B8321022EE.png

Userlevel 3
Badge +16

I don't think my Timer control is the same as yours look:

 

15168i49A09DEFA84FB2FE.jpg

 

There is no Infinite property like yours...

 

Also when i try to create the rule for Execute a controls method, it will not show the Timer control in the selection list....

Userlevel 5
Badge +16

Hi sharpharp1,

 

then you are not using the control that comes with k2 smartforms control pack 4.6.9,  I guess you have downloaded this from the market, right?

 

just try to make it through the controls properties 

 

and make the third line in the first timer rule 

 

Line 3) Properties of Time 2 is configured for General - Enabled False

 

 

and on the initialize method of the form disable the second timer

Userlevel 3
Badge +16

I did exactly how you said and used properties to ENABLE and DISABLE the Timers, but it ignores the setting.

 

When i run the form, the IE Pop comes up first and says "do you want to close this tab", then in the background the other K2 pop message comes up...

 

Both Timers are working independently and popping up every few seconds and completely ignoring the rules...

 

How do i install the timer you have? Do i have to upgrade my Blackpearl and Smartforms versions first?

Also, would i need to uninstall the Timer Control i have - Yes i downloaded and installed this from the Market a long time ago, as it was the only Timer control at that time...

 

IE doens't just shut down the window, it keeps forcing the user to answer the question about closing the Browser window... any way of Forcing IE to shut down the window without prompting using K2 rules?

 

Thanks for your on going help with this, you the man.

 

Userlevel 5
Badge +16

Hi sharpharp1,

 

You are most welcom man.

 you can't force the browser to close from k2 rules, this issue is known.

 

yes you need to upgrade K2 blackpearl and k2 smartforms to 4.6.9 at least, the latest version is 4.6.10 

 

before upgrading to any version have a look at the compatibility matrix to know if you can upgrade from the current version you have or you'll have to upgrade to another version then to the desired version

 

Note: there is a control pack comes with 4.6.9 that has the latest controls(good controls)  :)

Reply