blez
blez

Reputation: 5037

How to detect if antivirus/firewall is blocking my application?

I have a downloader which work fine, but sometimes the user's antivirus/firewall blocks its file write access and/or downloading. Is there a way to detect that?

Upvotes: 2

Views: 5907

Answers (1)

Julien Lebot
Julien Lebot

Reputation: 3092

Since you're using C# use a try/catch block and catch the UnauthorizedAccessException.
That's the cleanest and most standard way of handling it.

Note: this won't tell you if the AV caught it, and neither should you check: that's the problem of the user and their AV.
If your program was denied access to some of the user's resource and you believe you had a legitimate reason to access that resource, inform the user with a nice text boxt and let them sort it out with their AV. You can for example suggest that your downloader be in the AV's trusted program list.

Upvotes: 3

Related Questions