---
title: "How to delete notepad based on 24 hours timing? Asp.net C#"  
description: "How to delete notepad based on 24 hours timing? Asp.net C#"  
author: "Raja Ganapathy"  
published: 2016-08-08  
updated: 2016-08-17  
canonical: https://www.mindstick.com/forum/34162/how-to-delete-notepad-based-on-24-hours-timing-asp-dot-net-c-sharp  
category: "c#"  
tags: ["c#", "asp.net"]  
reading_time: 2 minutes  

---

# How to delete notepad based on 24 hours timing? Asp.net C#

I have [store](https://www.mindstick.com/articles/13125/tips-to-increase-sales-of-your-woocommerce-store) the [login](https://www.mindstick.com/articles/12852/styles-login-form-in-android) details ([username](https://www.mindstick.com/forum/12798/there-is-no-viewdata-item-of-type-ienumerable-selectlistitem-that-has-the-key-username) and [datetime](https://www.mindstick.com/forum/12949/how-to-validate-if-a-datetime-field-is-not-null-empty) ) in notepad.i want to [delete](https://www.mindstick.com/forum/33620/how-to-delete-record-from-list-in-mvc-using-ajax) 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](https://www.mindstick.com/blog/11920/top-3-voltas-split-acs-for-your-home) the username and datetime in notepad. and how to [retrieve](https://www.mindstick.com/forum/34400/how-to-retrieve-form-values-in-controller-action) the note pad datetime [value](https://www.mindstick.com/articles/23219/an-optimized-description-adds-value-to-experience-and-in-turn-effectively-guest-posting-packages) and [validate](https://www.mindstick.com/forum/1490/what-is-better-solution-for-validate-form-textboxs-value) 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.\

## Replies

### Reply by Anonymous User

Hi.. Create a windows service . for example you can see this url [https://www.mindstick.com/Articles/99/windows-service](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.


---

Original Source: https://www.mindstick.com/forum/34162/how-to-delete-notepad-based-on-24-hours-timing-asp-dot-net-c-sharp

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
