We help IT Professionals succeed at work.

Running a DB-based app from a network drive

Sinclair
Sinclair asked
on
Medium Priority
227 Views
Last Modified: 2010-05-18
I am developing a C# Windows Forms application that interacts with our Oracle database. The application can be launched from the command line, and it needs to access the command-line parameters. When I run this app locally, it works fine; i.e., when I type "MyApp.exe abc 123", it runs and does the right thing.

However, the ultimate fate of this app is to run from a network-mapped drive (so that everyone in the company can use it). When I copy the app to the network drive, and run it from there, it crashes with a security exception, because it does not receive permissions to access the database.

Is there any way to bypass this problem in a hassle-free way ? So far, I've been experimenting with two different solutions:

1). Create a strong name for my app, and add it manually to the list of approved apps in the .NET Configuration panel. This works, but this procedure is too complex for all our users to follow (and it will become prohibitively time-consuming if I end up installing new apps on each computer every time I develop them).

2). Publish the app to the network drive, using the Publish option in Visual Studio. This works, but I can't figure out how to pass command-line parameters to the app.

Ideally, I'd like the users to be able to run "X:\MyApp.exe abc 123" (where X is the network drive) and have it work without any extra hassle. Is there a way to do this in C# ?
Comment
Watch Question

Mohammed NasmanSoftware Developer
CERTIFIED EXPERT

Commented:
Do you have oracle client installed in the user clients?
even if your application run from the server, it still need oracle client to be installed and configured in each computer user

Author

Commented:
Yes, Oracle client is installed on all machines. BTW, I get the same security errors when I try to open files from the local drive.
Éric MoreauSenior .Net Consultant
CERTIFIED EXPERT
Top Expert 2016
Commented:
Hi Sinclair,

You need to adjust the security.

Open the Control Panel
Open Administrative tools
Open Microsoft .Net Framework 1.1 Wizards
Click Adjust .Net Security
click Next
Select Local Intranet
Change the level of trust to Full
click next
click Finish

Cheers!

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts
Software Developer
CERTIFIED EXPERT
Commented:
look at CasPol to help you
CasPol
"The Code Access Security Policy tool enables users and administrators to modify security policy for the machine policy level, the user policy level, and the enterprise policy level"

Using CasPol to Fully Trust a Share
http://blogs.msdn.com/shawnfa/archive/2004/12/30/344554.aspx

Why Is CasPol Prompting Me For Confirmation?
http://blogs.msdn.com/shawnfa/archive/2005/07/27/443975.aspx

Author

Commented:
emoreau:

Is trusting the Local Intranet going to be a security concern of some kind ?

mnasman:

I've used CasPol, and it works, but it seems like I need to authorize every application individually if I go that route. Is this right, or am I missing something ?
Éric MoreauSenior .Net Consultant
CERTIFIED EXPERT
Top Expert 2016

Commented:
>>Is trusting the Local Intranet going to be a security concern of some kind ?

every applications that you start from the Local intranet zone will be fully trusted.
Mohammed NasmanSoftware Developer
CERTIFIED EXPERT

Commented:
>>I've used CasPol, and it works, but it seems like I need to authorize every application individually if I go that route. Is this right, or am I missing something ?

yes, CasPol made for jobs like this :-)

Author

Commented:
Thanks guys, I think I'm going to use CasPol internally, though emoreau's solution is good too.
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.