Click here to Skip to main content
14,577,432 members
Rate this:
Please Sign up or sign in to vote.
See more:
I have a website with a form and I want to activate form submission and then if 4 days have passed from activation date I want to disable submission of the form until activated again.
How is this possible ?
Can someone share the code or help?

What I have tried:

I’m not sure how to go about it.
Posted
Updated 30-Jun-20 19:52pm

1 solution

Rate this:
Please Sign up or sign in to vote.

Solution 1

Depends how complicated you want this to be: anything form a simple "store the expiry date, and compare it" to a full bought-in licencing package is possible.

The simple one is trivial: add a Settings option called ExpiryDate, make it DateTime, and set it to 2001-01-01 00:00.
When your app loads, read the expiry date and compare it to the current DateTime.Now value.
If it's greater that Now, all is fine.
Otherwise, re-activation is needed.

When you activate, take DateTime.Now, then call AddDays(4) on it, and save the new value in the Settings.
   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100