Results 1 to 7 of 7

Thread: [2.0] System.Security.SecurityException

  1. #1

    Thread Starter
    Hyperactive Member Pozzi's Avatar
    Join Date
    Feb 2001
    Location
    The Stones!
    Posts
    507

    Unhappy [2.0] System.Security.SecurityException

    Hi,

    I've developed an application that reads data from a CSV file. All is fine when I access the file on my local PC, the one I developed it on.

    The problem is that if I try and access a file on a networked PC using a network share I receive the following error: -


    ************ Exception Name ************

    System.Security.SecurityException

    **************** Source ****************

    mscorlib

    *************** Message ****************

    Request for the permission of type 'System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.


    I've checked all I can think of e.g. user permission and rights, I can see the file from the PC giving me the error and open it and save it.

    Does anyone have any ideas where to start or what this message means?

    Regards
    VB.Net (VS 2010)

  2. #2
    PowerPoster 2.0 Negative0's Avatar
    Join Date
    Jun 2000
    Location
    Southeastern MI
    Posts
    4,367

    Re: [2.0] System.Security.SecurityException

    My guess is that this is a .Net permissions issue. You need to explicitly grant your app the right to run from a network share. You can use the .Net 2.0 Framework configuration app to add it by hand.

  3. #3

    Thread Starter
    Hyperactive Member Pozzi's Avatar
    Join Date
    Feb 2001
    Location
    The Stones!
    Posts
    507

    Re: [2.0] System.Security.SecurityException

    Hi,

    Thanks for the reply.

    The thing is my application isn't running from a network share.

    It's stand alone on another PC trying to access the file to read, which is on a network share.

    Regards
    VB.Net (VS 2010)

  4. #4
    PowerPoster 2.0 Negative0's Avatar
    Join Date
    Jun 2000
    Location
    Southeastern MI
    Posts
    4,367

    Re: [2.0] System.Security.SecurityException

    Is it running as a service or just a normal desktop app?

  5. #5

    Thread Starter
    Hyperactive Member Pozzi's Avatar
    Join Date
    Feb 2001
    Location
    The Stones!
    Posts
    507

    Angry Re: [2.0] System.Security.SecurityException

    Hi,

    Just as a normal app. I now know it's not my code, as I tried it on a different PC and it works fine, so it must be the configuration of the PC, but what?

    The PC throwing up the exception is using a user with the same name & password and is in the Administrator group. I can see the share from that PC and open and save the file through notepad.

    All looks the same, don't you just love Micro****e!!!

    Any ideas or help would be much appreciated.

    Regards
    VB.Net (VS 2010)

  6. #6
    PowerPoster 2.0 Negative0's Avatar
    Join Date
    Jun 2000
    Location
    Southeastern MI
    Posts
    4,367

    Re: [2.0] System.Security.SecurityException

    Is it an XP SP2 machine? Is the builtin firewall blocking your app from talking to the network?

    Try disabling the firewall and see if it works. If it does, reenable the firewall and add your app to the firewall exceptions.

  7. #7

    Thread Starter
    Hyperactive Member Pozzi's Avatar
    Join Date
    Feb 2001
    Location
    The Stones!
    Posts
    507

    Re: [2.0] System.Security.SecurityException

    Hi,

    I'm sure I did that and it made no difference, but will try it again.

    The app I developed is actualy a 'Plug-In' for an application and the app using the plug-in works fine with the firewall running, I will look at it again though.

    Regards,
    VB.Net (VS 2010)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width