Am using
DateTime.Now.ToString("MM/dd/yyyy");
to get the current date. If i change the system date the date returned by DateTime.Now() also changes which is vulnerable.
Any one has a solution for this? Thanks
Am using
DateTime.Now.ToString("MM/dd/yyyy");
to get the current date. If i change the system date the date returned by DateTime.Now() also changes which is vulnerable.
Any one has a solution for this? Thanks
You would have to use a NTP server to retrieve the current date/time in that case. Look at an implementation posted in another question. How to Query an NTP Server using C#?
When you don't trust the time of the machine you can use an NTP (Network Time Protocol) client call to ask a trusted time server for the correct time.
There are many client codes. For example http://www.dotnet-snippets.com/dns/c-simple-network-time-ntp-protocol-client-SID571.aspx
Hai all thanks for the comments and gateways.
I would like to share one link which helped me.
http://nickstips.wordpress.com/2010/02/12/c-get-nist-internet-time/