Alerts to be displayed in web application for every 2 minutes

Posted by Praveenbandi under ASP.NET on 1/19/2010 | Views : 1943 | Status : [Member] | Replies : 7
Alert to be displayed in web application for every 2 minutes as pop up. Here in this web application user enters his reminder alert for the day and it should be alerted to the user for every 2 minutes. please help me in this task to be completed it is urgent. There is one way we can do this by using Windows service but i dont want to use it. Is there a way to do in web application.




Responses

Posted by: Abhi2434 on: 1/19/2010 [Member] [Microsoft_MVP] [MVP] Silver

Up
0
Down
It is easily possible if your application is opened. You can use normal javascript method in body onload event
setInterval("youralert();", 1000*60*2)

Write all your code in function youralert() and every 2 minutes the method will get invoked.


On the other hand it is quite impossible to access local system from the browser control because of security reason, thus if your requirement to add a Scheduler kind of thing, you need to have an installer to install your tool to the client and then he can add a task.
Just if you have a client application installed, add an entry to Windows Scheduler to run your popup executable after an interval.

Other than that, in web application we generally do send emails after as alert when user subscribes. This might be one option for you as well..



www.abhisheksur.com

Praveenbandi, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Sagarp on: 1/19/2010 [Member] Bronze

Up
0
Down
function warnuser()
{
if (confirm("There has been no activity for some time.\nClick 'OK' if you " +
"wish to continue your session,\nor click 'Cancel' to log out.\nFor your " +
"security if you are unable to respond to this message\nwithin 2 minutes you " +
"will be logged out automatically."))
{
//post the page to itself
document.location.href = "Main.aspx"
}
else
{
document.location.href = "Index.aspx"
}
}

Style 2 is simpler and simply posts a warning:

function SessionAlert()
{
alert("Your Session will time out in 19 minutes");
}
setTimeOut("SessionAlert", 1 * 60 * 1000);

I tried setting the second one for just a minute just to see if it would work. It doesn't. Following is the setting that is deployed on the web.config page in the ASP.net applcation (and it does time out in 20 minutes):

<sessionState mode="InProc" cookieless="false" timeout="20" />

Thanks
SagarP
http://www.emanonsolutions.net
http://emanonsolutions.blogspot.com/

Praveenbandi, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Sagarp on: 1/19/2010 [Member] Bronze

Up
0
Down
ref this link

http://programmerramblings.blogspot.com/2009/03/aspnet-session-timeout-control-jquery.html


thanks
sagar

Thanks
SagarP
http://www.emanonsolutions.net
http://emanonsolutions.blogspot.com/

Praveenbandi, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Abhi2434 on: 1/19/2010 [Member] [Microsoft_MVP] [MVP] Silver

Up
0
Down
Hey Sagarp,

Did you actually read the Query ?

I think the user wanted to subscribe for an alert and it will alert after every 2 min.

there is nothing to deal with ASP.NET session I think.


www.abhisheksur.com

Praveenbandi, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Sagarp on: 1/19/2010 [Member] Bronze

Up
0
Down
yes,

i can read he is write web application.i think session can use there

Thanks
SagarP
http://www.emanonsolutions.net
http://emanonsolutions.blogspot.com/

Praveenbandi, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Rtpharry on: 1/19/2010 [Member] [MVP] Bronze

Up
0
Down
Hey,

Just want to point out this article if you are deciding between using setInterval() or setTimeout()

http://weblogs.asp.net/bleroy/archive/2009/05/14/setinterval-is-moderately-evil.aspx

Might save you some headache further down the line :)

Praveenbandi, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Nishithraj on: 1/19/2010 [Member] Bronze

Up
0
Down
Write a function in Javascript as follows

function checkTimeOut(millisec)

{
window.clearInterval(Showid);
Showid = window.setInterval("Refresh()", millisec);
return true;
}


Convert the time that you require to millisecond and pass that to this function (in millisec argument)

Mark this as answer, if it is.....

With regards
Nishithraj Narayanan

Praveenbandi, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response