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.aspx 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.XMLHTTP");
//Initializing the callback method which should be called.
oxmlhttp.onreadystatechange = onSessionCheckReceiver;
//Retrieving the required file
oxmlhttp.Open("GET","pingreceiver.aspx",true);
//Initiating the request
oxmlhttp.send();
}
function onSessionCheckReceiver()
{
if (oxmlhttp.readyState == 4) //if request has be processed
{
//No code for this example
}
}
m_nTimerID = window.setInterval("onSessionCheck();",m_nTimetoch eck);
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.HttpCookie c = new System.Web.HttpCookie("EXPIREANONYMOUSUSER",
"EXPIRE");
c.Expires = DateTime.Now.AddMonths(6);
Response.Cookies.Add(c);
here "c.Expire" is expiration time
FormsAuthenticationTicket ticket = new FormsAuthenticationTicket(
1,
txtUserName.Text,
System.DateTime.Now,
c.Expires,
// This is my exprition duration
false,
txtPassword.Text,
FormsAuthentication.FormsCookiePath);
Regards
Karunakara Rao