How to delete notepad based on 24 hours timing? Asp.net C#

Total Post:2

Points:14
C#  ASP.Net 
C#
 904  View(s)
Ratings:
Rate this:
I have store the login details (username and datetime ) in notepad.i want to delete this note pad in the time of 23.59.59. and after the next day login again notepad is create.how to delete notepad based on timings.how to split the username and datetime in notepad. and how to retrieve the note pad datetime value and validate the which one is first login person.

What i have Tried

I have done to login details(username and datetime)to store in notepad.but how to delete notepad based on timings.
  1. Post:281

    Points:2003
    Re: How to delete notepad based on 24 hours timing? Asp.net C#

    Hi.. 
    Create a windows service . for example you can see this url https://www.mindstick.com/Articles/99/windows-service.
    by using windows service you can delete notepad file using timer tick event.

    protected override void OnStart(string[] args)
            {
                timeticker= new Timer();
                timeticker.Interval = 24;//  
                timeticker.Elapsed += new System.Timers.ElapsedEventHandler(deletenotepad_tick);
                timeticker.Enabled = true; 
            }
        private void deletenotepad_tick(object sender, ElapsedEventArgs e)
            {
                //here write delete notepade code
                if(File.Exists(@"C:\test.txt"))
                     {
                        File.Delete(@"C:\test.txt");
                      }
        
            }
          protected override void OnStop()
            {
                timeticker.Enabled = false;
                
            }
    Thanks.

      Modified On Apr-11-2018 04:59:28 AM

Answer