unhandled SecurityException in Visual Basic 2005 Express

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • KenEisman

    #1

    unhandled SecurityException in Visual Basic 2005 Express

    I'm trying to read in a text file using code that I copied and pasted from
    the MS help file.

    Using Reader As New _
    Microsoft.Visua lBasic.FileIO.T extFieldParser( "c:\bankche ck")

    At this line I get "Request for the permission of type
    'System.Securit y.Permissions.F ileIOPermission , mscorlib, Version=2.0.0.0 ,
    Culture=neutral , PublicKeyToken= b77a5c561934e08 9' failed."

    I've tried researching this in the help files and on the web but, I must
    confess, that what I've found has only confused me more.

    The file DOES exist and I have full permissions to it. What am I doing wrong
    and how can I fix it?

    Thanks for you help.
    Ken

  • Cor Ligthert [MVP]

    #2
    Re: unhandled SecurityExcepti on in Visual Basic 2005 Express

    Ken,

    I tried your command and cannot get any error. Your file description looks
    strange to me, are you sure it exist and is a text file?

    Cor

    "KenEisman" <KenEisman@disc ussions.microso ft.comschreef in bericht
    news:23CD5082-BCD9-48E1-8D5A-62EC3AB051F8@mi crosoft.com...
    I'm trying to read in a text file using code that I copied and pasted from
    the MS help file.
    >
    Using Reader As New _
    Microsoft.Visua lBasic.FileIO.T extFieldParser( "c:\bankche ck")
    >
    At this line I get "Request for the permission of type
    'System.Securit y.Permissions.F ileIOPermission , mscorlib, Version=2.0.0.0 ,
    Culture=neutral , PublicKeyToken= b77a5c561934e08 9' failed."
    >
    I've tried researching this in the help files and on the web but, I must
    confess, that what I've found has only confused me more.
    >
    The file DOES exist and I have full permissions to it. What am I doing
    wrong
    and how can I fix it?
    >
    Thanks for you help.
    Ken
    >

    Comment

    • Phill W.

      #3
      Re: unhandled SecurityExcepti on in Visual Basic 2005 Express

      KenEisman wrote:
      At this line I get "Request for the permission of type
      'System.Securit y.Permissions.F ileIOPermission , mscorlib, Version=2.0.0.0 ,
      Culture=neutral , PublicKeyToken= b77a5c561934e08 9' failed."
      The file DOES exist and I have full permissions to it.
      /You/ might have, but your /code/ doesn't.
      Code Access Security, part of the .Net Framework, does away with all
      that "you have to run it under this account for it to work" nonsense.
      Every program runs in a security "sandbox" (although the "LocalZone" one
      is /pretty/ big!).

      Are you running this code from a network file share? Something like

      \\server\share\ ...\myprogram.e xe

      If so, your program runs in a /much/ smaller "sandbox" - by default, the
      Framework doesn't distinguish between your network share and
      www.DodgyAndDangerousSoftware.com (apologies to anyone who actually owns
      a site of this name!)

      Read up on the CASPOL (command line) utility or find the "Microsoft .Net
      Framework ?.? Configuration" program (GUI) in your PC's Administative
      Tools.

      HTH,
      Phill W.

      Comment

      Working...