That looks more like a perf counter or a named mutex.
Without knowing what method you've called it's hard to answer this question
exactly.
If it's a perf counter, the user must have the required access (which we
don't know). If it's a named mutex, whatever is creating the mutex must give
access to the current user. Again, since we don't know what you're calling
we can't tell how to discern if the current user has the required access to
do what you want.
Most method list the security requirements need in order to call them. You
can either add a try/catch(SecurityException) block around the code that may
not have access, or if you know the specific security permission that is
required you can create an instance of that type and call its Demand method
with a try/catch(SecurityException)--which would ensure things don't get into
an unknown state.
--
Browse
http://connect.microsoft.com/VisualStudio/feedback/ and vote.
http://www.peterRitchie.com/blog/ Microsoft MVP, Visual Developer - Visual C#
[quoted text, click to view] "Gene Chang" wrote:
> I am writing an application where I obtain the IP address of the local
> adapter. When the user is logged in as Guest, this call fails with an
> exception: Access to the path 'Global\.net clr networking' is denied
>
> I think this is because the guest user is not allowed to access
> System.Net.
>
> How do I query if the current user is allowed ot use certain
> assemblies or modules? For example, my networking functionality.
>
> Thanks.
>
> Gene Chang