How to access local folders when running code from a network share

I run an application from a network share, this application, then try to check if the path "C: \ temp" exists and returns true or false.

If the code is running locally, no problem. If it runs from a network share, I get false even though the folder exists locally.

C # code on the 2.0 framework

thanks

0


source to share


2 answers


You will need to be running under elevated privileges to see this. It is part of Code Access Security .



I would recommend using the application data folder returned by Environment.GetFolderPath instead of the hardcoded path.

+2


source


This is due to the .NET platform security policy settings. By default, code that runs from the intranet zone (which is assigned a UNC path) is not fully trusted, limiting some of your code to succeed.

You can use the configuration wizard to change these settings if needed. Open a Visual Studio command prompt and run "Configwizards.exe".



See also this link for CAS configuration information.

0


source







All Articles