473,626 Members | 3,305 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Application should not be Expire time in ASP.net (using this FormsAuthentica tionTicket )

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

Nov 19 '05 #1
2 2066
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

Nov 19 '05 #2
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.

"saidevakum ar" <sa**********@d iscussions.micr osoft.com> ¦b¶l¥ó
news:EA******** *************** ***********@mic rosoft.com ¤¤¼¶¼g...
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

Nov 19 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
12908
by: David Graham | last post by:
Hi I have asked this question in alt.php as the time() function as used in setcookie belongs to php - or does it belong equally in the javascript camp - bit confused about that. Anyway, can anyone here put me straight on the following: I had a look at the time() function came across this: "To clarify, it seems this function returns the time of the computer's clock and does not do any timezone adjustments to return GMT, so you are...
6
4116
by: Stanley | last post by:
has anyone managed to use cache application block in a web application? thanks stanley
7
7183
by: What-a-Tool | last post by:
How does the expire date work setting it server side with asp. I know with javascript setting it client side it will be set to the clients local time, and therefore expire when the clients local time reaches the set expire-time. But if it is an expire time set on my server in California, and the cookie is put on a computer that is running on London Time, and the expire time is set at the server as 20 minutes from now, the London computer...
1
1653
by: Grey | last post by:
I read from some site to learn the form authentication with AD that it needs to create a FormsAuthenticationTicket to store the group list. I want to that what is the function of FormsAuthenticationTicket?? is it a must to create those ticket if I need to get the user's group list??? If I only want to authenticate the username and password with AD, do I need to create the FormsAuthenticationTicket??? Million Thanks
2
3315
by: Dicky Cheng | last post by:
Hi, I am using absolute expiration to expire my cache object in Cache API. And I set it to expire after 60min. Then I test it, it cache, and everything fine. Then I stop working and lock computer (pc still running), then leave office. Second day I come to the office and unlock computer, the cache still doesn't expire! (It already exceed 60min). And I use the cache, and it still working. And after awhile, the cache start flushing. So I am...
1
1681
by: ad | last post by:
The codes below is copy from msdn about FormsAuthenticationTicket. It add FormsAuthenticationTicket to cookie. How can I add the FormsAuthenticationTicket to URL not to Cookie? /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// if (Membership.ValidateUser(username, password))
1
14071
by: Polani | last post by:
Hi Guys , I am taking DB2 Online backups through TSM API daily. When i check the database configuration parameters , it shows me " Number of database backup verions to maintain"= 12. This is also shown when i check " db2 list history db " it showed me 12 versions of backups which is ok, but problem is that when i run "db2adutl query" it showed me 69 or 70 entries like that:::
5
13781
by: Jono | last post by:
Hi Everyone, Most tutorials I've seen address cookies from the server's perspective, assuming that the client (usually a browser like Internet Explorer) will manage the persistence. I am faced with writing a C#.NET client that uses a web reference to a SOAP web service, and I need to persist the cookies myself, or so it seems. The cookies stored in temporary internet files - accessed each time I hit the web service help page from IE...
5
4046
by: Omer | last post by:
hi Everyone, I am using ASP.Net 2.0. When user logins, I check the credential and then made the cookie. My hoster's server is in Arizona region and I am in Pakistan. I set cookie's expiration time as 4 hours. It works perfectly fine on my PC and many other PCs which have correct time. But, if I set date to some old date, user is simply unable to login. This makes sense as probably cookie timing is not matching. Dilemma is that many users...
0
8262
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8637
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8364
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8502
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6122
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4196
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2623
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1807
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1507
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.