Click here to Skip to main content
15,896,154 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Dear All,

Can anyone convert the following lines of code into Javascript.
VB
Public Function GetLastSystemShutdown() As DateTime
        Dim sKey As String = "System\CurrentControlSet\Control\Windows"
        Dim key As Microsoft.Win32.RegistryKey = Microsoft.Win32.Registry.LocalMachine.OpenSubKey(sKey)
        Dim sValueName As String = "ShutdownTime"
        Dim val As Byte() = key.GetValue(sValueName)
        Dim valueAsLong As Long = BitConverter.ToInt64(val, 0)
        Return DateTime.FromFileTime(valueAsLong)
End Function


Above code is to get Users System Last Shutdown DateTime.......
Above code is working but returning only Server last shutdown datetime.

Any Suggestions............

Thanks in advance...........
Posted
Updated 24-Oct-11 0:18am
v4

Why you want to convert this code to JavaScript?

I guess you are doing Asp.Net development. If my assumption is correct then use "Ajax". Using this you can execute your Server side code(VB/C#) from JavaScript.

Have a look at my below Tips/Tricks Article on "Asp.Net Ajax". In this article, I have used C# but I think it should not be hurdle to understand concept of "Ajax".
Simplifying Asp.Net Core Ajax

Hope this is helpful.
 
Share this answer
 
Comments
Freelancers 24-Oct-11 5:50am    
Thanks for replying and your suggestion but my logic is to get the Users System last ShutDown date and time. Any suggestion........
RaisKazi 24-Oct-11 6:07am    
If your posted VB.Net code is giving you the expected result, then you only have to call it from your JavaScript using Ajax.
 
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