Click here to Skip to main content
15,892,199 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
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

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.
 
Share this answer
 

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900