0

I know this question exists:

Event to detect System wake up from sleep in C#

However, that appears to be only for WinForms. I need to do this from an ASP Intranet application written in C#. Is this possible?

Community
  • 1
  • 1
Johnny Bones
  • 8,786
  • 7
  • 52
  • 117
  • 2
    Are you wanting to detect the *server* waking from sleep (that is, after all, where all of your C# code is running), or detecting a *user*s machine, which happens to have had a browser window open connected to your site, waking from sleep? The first may be doable but unusual. The second, not so much. – Damien_The_Unbeliever May 21 '15 at 14:16
  • The second, and I didn't think it was possible but wanted to double-check with a knowledgeable community. Thanks! – Johnny Bones May 21 '15 at 14:18

1 Answers1

2

It's not possible to detect system events on the client side (browser-side) of a web application (not without some plugin that can directly interface with the browser and with the OS).

Using a native plugin this would be doable but then the plugin would have to be implemented for each browser / platform that you intend to support.

If your application is strictly an intranet application and you have control over what browser is used and on what platform(s), adding a plugin to the browser may be a lot less work than in the general case.

Based on my experience, it's best to implement such plugins using C / C++, not C#, so you avoid various issues with trying to load the .NET framework into the browser process. This may have changed, though - I only did IE plugins and it was some years ago.

xxbbcc
  • 16,930
  • 5
  • 50
  • 83