Running a project from a mapped network drive

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • =?Utf-8?B?SGF6ZWxyYWg=?=

    #1

    Running a project from a mapped network drive

    I posted this question on a different website but I didn't get a response
    that worked.

    If I run this code from my computers hard drive, C:\, it detects the
    networked mapped drive, J:\, just fine:


    Private Function FolderExists() As Boolean Return
    My.Computer.Fil eSystem.Directo ryExists("J:\Te mplate_Alpha\") End Function
    ' Outputs: True


    But when I copy the same VB.NET project to the network mapped J:\ drive, the
    output changes to False. The project is located in a different folder on the
    J:\ drive and is not a sub folder of J:\Template_Alp ha\.

    I'm running VS 2008

    Is there some kind of network permissions in Visual Studio I have to set to
    get this code to work? I seem to remember there being a security setting
    that will allow this code to work.

    --

    -Hazelrah
  • sstory

    #2
    Re: Running a project from a mapped network drive

    Networked vb.net code doesn't work right if placed on the network and then
    called locally. You will need to grant trust rights to it. Go to control
    panel, Administrative Tools, Microsoft .NET Framework [your version]
    Configuration, then inside there right-click Applications, choose Add to add
    your app, then configure it.

    BTW, hard coding a path like that with a changing drive letter is a terrible
    practice. Why not relative paths? Or better a config file?
    "Hazelrah" <Hazelrah@discu ssions.microsof t.comwrote in message
    news:7320C2B9-8C97-4701-87E6-986AEFC4CC02@mi crosoft.com...
    >I posted this question on a different website but I didn't get a response
    that worked.
    >
    If I run this code from my computers hard drive, C:\, it detects the
    networked mapped drive, J:\, just fine:
    >
    >
    Private Function FolderExists() As Boolean Return
    My.Computer.Fil eSystem.Directo ryExists("J:\Te mplate_Alpha\") End
    Function
    ' Outputs: True
    >
    >
    But when I copy the same VB.NET project to the network mapped J:\ drive,
    the
    output changes to False. The project is located in a different folder on
    the
    J:\ drive and is not a sub folder of J:\Template_Alp ha\.
    >
    I'm running VS 2008
    >
    Is there some kind of network permissions in Visual Studio I have to set
    to
    get this code to work? I seem to remember there being a security setting
    that will allow this code to work.
    >
    --
    >
    -Hazelrah

    Comment

    • =?Utf-8?B?SGF6ZWxyYWg=?=

      #3
      Re: Running a project from a mapped network drive

      sstory,

      Thank you for your reply.
      You will need to grant trust rights to it. Go to control
      panel, Administrative Tools, Microsoft .NET Framework [your version]
      Configuration, then inside there right-click Applications, choose Add to add
      your app, then configure it.
      Hmm, I'm working with Framework 2.0 or 3.5 (depending on the particular
      project) and I only see Framework 1.1 in the Administrative tools. The link
      points to C:\WINDOWS\Micr osoft.NET\Frame work\v1.1.4322\ mscorcfg.msc, but I do
      not see this file in the other Framework folders. Do you know what the
      equivelent is.

      Also, I discovered that the program works on my computer as it is, but it
      doesn't work on either of my project partner's computers, even though we're
      all accessing the same network drive. I may have done some security setting
      a few months back, but I can't remember what it was.
      BTW, hard coding a path like that with a changing drive letter is a terrible
      practice.
      This is just a simple example program to highlight the problem and not the
      actual code.


      --

      -Hazelrah

      Comment

      Working...