| re: Application should not be Expire time in ASP.net (using this FormsAuthenticationTicket )
Another possible way would be to have another blank aspx page within
<iframe> periodically refresh itself let's say, 5 minutes.
This will ensure the server won't wipe your user's session. The page will
not flicker because it's within iframe, and the response should be quick
because the aspx page request and response virtually contains nothing.
"saidevakumar" <saidevakumar@discussions.microsoft.com> ¦b¶l¥ó
news:EA0A9D47-78FE-4F0E-BF7E-A441C85511F0@microsoft.com ¤¤¼¶¼g...[color=blue]
> Hi Karunakar,
>
> I have a solution for this. The idea of my solution is simple, session[/color]
will[color=blue]
> timeout only when there are no more requests from that particular user.[/color]
What[color=blue]
> we can do is continously ping the webserver at equal intervals. Let's say[/color]
you[color=blue]
> 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[/color]
the[color=blue]
> 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:
>[color=green]
> > 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[/color][/color]
System.Web.HttpCookie("EXPIREANONYMOUSUSER",[color=blue][color=green]
> > "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
> >
> >
> >
> >[/color][/color] |