Today, we are going to discuss how to block a specific site for a specific time, using host file.
For this task, we need to follow only two steps.
- Create two console applications (one for disabling and one for enabling).
- Need to create one scheduler which will block and unblock the site.
Step 1: The below console application will write the sitetoblock code in host file.
Once you've written the code in the file, the site will be blocked. The below mentioned console application will be used for unblocking the site. It will remove that line which was added for blocking the site in host file.
Step 2: Need to create two schedulers and attach the console applications to them and need to set time according to our time.
Steps to attach the console application to the scheduler.
Similarly, create scheduler for unblocking the application and running the scheduler.
Thanks for visiting this blog.