File system access

Discussion in 'ASP .Net Web Services' started by Amir Tohidi, May 11, 2007.

  1. Amir Tohidi

    Amir Tohidi Guest

    Hi

    I have a web service that calls our internal framework for some processing.
    The assembly called needs to know what directory it is located in. It does
    this using:

    Public Shared ReadOnly Property AssemblyPath() As String
    Get
    Dim assemblyDirectory As String
    assemblyDirectory =
    Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly.GetName.CodeBase)
    Return assemblyDirectory.Remove(0, "file:\".Length)
    End Get
    End Property

    When this property get is called, we get the following error:

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

    When our web sites call the same assembly, we don't get the problem.

    Any idea?

    Thanks
    Amir Tohidi, May 11, 2007
    #1
    1. Advertising

  2. Amir Tohidi

    Egghead Guest

    Something wrong that you cannot use "AppDomain.CurrentDomain.BaseDirectory"

    --
    cheers,
    RL
    "Amir Tohidi" <> wrote in message
    news:...
    > Hi
    >
    > I have a web service that calls our internal framework for some
    > processing.
    > The assembly called needs to know what directory it is located in. It does
    > this using:
    >
    > Public Shared ReadOnly Property AssemblyPath() As String
    > Get
    > Dim assemblyDirectory As String
    > assemblyDirectory =
    > Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly.GetName.CodeBase)
    > Return assemblyDirectory.Remove(0, "file:\".Length)
    > End Get
    > End Property
    >
    > When this property get is called, we get the following error:
    >
    > System.Security.SecurityException: Request for the permission of type
    > 'System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.0.0,
    > Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.
    >
    > When our web sites call the same assembly, we don't get the problem.
    >
    > Any idea?
    >
    > Thanks
    >
    Egghead, May 14, 2007
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. S. Justin Gengo
    Replies:
    0
    Views:
    846
    S. Justin Gengo
    Jul 14, 2003
  2. Chris Pratt

    Remote file access system?

    Chris Pratt, Nov 23, 2003, in forum: ASP .Net
    Replies:
    1
    Views:
    358
    Arthur Nesterovsky
    Nov 23, 2003
  3. MichaelR

    File System Access

    MichaelR, Dec 14, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    362
    Scott Allen
    Dec 14, 2004
  4. =?Utf-8?B?UmFzaG1pS3Vsa2k=?=

    cannot access a .aspx file from another system in local LAN

    =?Utf-8?B?UmFzaG1pS3Vsa2k=?=, Mar 31, 2006, in forum: ASP .Net
    Replies:
    1
    Views:
    581
    Alexey Smirnov
    Mar 31, 2006
  5. Rick
    Replies:
    1
    Views:
    565
    Walter Wang [MSFT]
    Sep 10, 2007
Loading...

Share This Page