Hi Karunakar,
I have a solution for this. The idea of my solution is simple, session will
timeout only when there are no more requests from that particular user. What
we can do is continously ping the webserver at equal intervals. Let's say you
have your web application's time out set as 20 mins. We will ping the
webserver every 15mins. For this I am using the xmlHTTP object to ping the
webserver.
To implement this
Step 1: Create a dummy page pingreceiver.as px on the server
Step 2: In the HTML portion of the page copy the following javascript code
Ofcourse, you can move the following code into any script file also and
include that script file in the html portion of the file.
var m_nTimetocheck = 15 * 60000; //This variable defines the period when the
client application has to ping the server.
var m_nTimerID; // A variable to hold the timer handle
var oxmlhttp; // An object to hold the XMLHTTP object.
function onSessionCheck( )
{
//Creating an instance of the xmlhttp object.
oxmlhttp = new ActiveXObject(" Microsoft.XMLHT TP");
//Initializing the callback method which should be called.
oxmlhttp.onread ystatechange = onSessionCheckR eceiver;
//Retrieving the required file
oxmlhttp.Open(" GET","pingrecei ver.aspx",true) ;
//Initiating the request
oxmlhttp.send() ;
}
function onSessionCheckR eceiver()
{
if (oxmlhttp.ready State == 4) //if request has be processed
{
//No code for this example
}
}
m_nTimerID = window.setInter val("onSessionC heck();",m_nTim etocheck);
Step 3: Run the application. You will notice that the application is not
expiring even though there is no activity on the website.
Let me know if this code has been useful for you..
thanks & regards
Saidevakumar
"karunakar" wrote:
Hi All
I dont want to expire the applicatoion
Once login the application i dont want to expire the application
Presently iam doing using cookies this is not working fine
Please help me out
I was doing like that
System.Web.Http Cookie c = new System.Web.Http Cookie("EXPIREA NONYMOUSUSER",
"EXPIRE");
c.Expires = DateTime.Now.Ad dMonths(6);
Response.Cookie s.Add(c);
here "c.Expire" is expiration time
FormsAuthentica tionTicket ticket = new FormsAuthentica tionTicket(
1,
txtUserName.Tex t,
System.DateTime .Now,
c.Expires,
// This is my exprition duration
false,
txtPassword.Tex t,
FormsAuthentica tion.FormsCooki ePath);
Regards
Karunakara Rao