SecurityException

This is a discussion on SecurityException within the C# Programming forums, part of the General Programming Boards category; Can anyone please tell me what would cause the exception that I have included with this post. The condition is ...

  1. #1
    Registered User
    Join Date
    Feb 2003
    Posts
    184

    SecurityException

    Can anyone please tell me what would cause the exception that I have included with this post. The condition is this: I am logged on to a server, I navigate through windows explorer to the machine where the c# application resides, when I double click the executable I get a System.Security.SecurityException on the Initialization method. What causes that?????????????????
    Attached Images Attached Images  

  2. #2
    the hat of redundancy hat nvoigt's Avatar
    Join Date
    Aug 2001
    Location
    Hannover, Germany
    Posts
    3,139
    I navigate through windows explorer to the machine where the c# application resides
    Which means you are trying to execute code from a potential unsafe source ( the network ). Pretty much anything is blocked for such code in .NET. There are tools in your system settings that allow you to modify your security policies.

    ( Note that even if the source is your own PC that you mapped to a network share, it's considered 'network' and unsafe. )
    hth
    -nv

    She was so Blonde, she spent 20 minutes looking at the orange juice can because it said "Concentrate."

    When in doubt, read the FAQ.
    Then ask a smart question.

  3. #3
    Registered User
    Join Date
    Feb 2003
    Posts
    184
    This exception actually comes about when it hits the Initialize Components routine. I created a very small app that has a window, some buttons and combo boxes etc. When I run it the same way, it runs with no problem. It is not near as complicated as the audio program. Why would one run but not the other????? and What security policies do you think I would have to modify????????

    Thanks,
    Kendal

  4. #4
    Something Clever ginoitalo's Avatar
    Join Date
    Dec 2001
    Posts
    187
    Allow the code from the intranet to run in full trust mode.
    Use the MS .NET framework configuration tool for this.
    I believe there is a way to configure VERY specific security settings for an app (ie. can access only THIS registry key, and no others) but I can't find out how to do that. (if someone knows, please post it)

    You'll be able to run a hello world type program but as soon as the program tries to access a network resource (or something of that type) the framework throws an exception for your protection.

Popular pages Recent additions subscribe to a feed

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21