Imran Shams Imran Shams - 1 month ago 21
ASP.NET (C#) Question

Set windows clock in Asp.net c#

I need to set windows clock in my Asp.net website (Written in C#)

I found a solution in stackoverflow at:

How do I set the Windows system clock to the correct local time using C#?

But when I use this I give exception:

A required privilege is not held by the client

My Application poll Identity is: LocalSystem

Answer

it is not a matter of "I need exact C# function for my problem", this is misguided. This is a security issue. Meddling with the clock is bad. Anyhow, to solve this you may try running the application pool under a user account that is member of the Administrators group and disable UAC.

You wont be able to change the clock on remote clients.

... also don't run an antivirus!

Oh, and disable clock synchronization of your system settings.