Running a project from a mapped network drive

H

Hazelrah

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.FileSystem.DirectoryExists("J:\Template_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_Alpha\.

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.
 
S

sstory

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?
 
H

Hazelrah

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\Microsoft.NET\Framework\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.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top