How to get Date Time from Internet and compare with one specific date, if the date is equal and greater then allow to register page else redirect application closed the page. My below code have one issue is that if a user will change system date, then its going to redirect to register page. That's why I need internet and redirect based on condition. And one more thing I am executing my application in local host.
Below is my C# code:
string date = "01/04/2016";
DateTime myDate = DateTime.ParseExact(date, "dd/MM/yyyy",
System.Globalization.CultureInfo.InvariantCulture);
if (DateTime.Today>=myDate)
{
// Allow redirect to registration page.
}
else
{
Response.Redirect("ApplicationClosed.aspx");
}