1

I have setup my sqlite database path as

  string AppPath = System.IO.Path.GetDirectoryName(Application.ExecutablePath);
  dbName = AppPath + "\\data\\rbssystems.sqlite";

But when application is packed and installed using setup, my application uses

C:\Users\<username>\AppData\Local\VirtualStore\Program Files\RBS\data

it should be using

C:\Program Files\RBS\data

Can anyone tell whats going around and how to make it read database from

C:\Program Files\RBS\data

Thanks

3
  • well....where are you executing the application from? Commented Mar 8, 2014 at 1:55
  • C:\Program Files\RBS\ Commented Mar 8, 2014 at 1:55
  • ! wonder why the post is downvoted, for me it seem to be a genuine question Commented Mar 8, 2014 at 2:01

1 Answer 1

3

Your app can't write to C:\Program Files unless it has administrative privileges. Windows automatically redirects you to C:\Users\<username>\AppData\Local\VirtualStore\Program Files instead. See this article for the explanation: http://blogs.windows.com/windows/archive/b/developers/archive/2009/08/04/user-account-control-data-redirection.aspx

Application data should always be in the AppData folder, never in Program Files.

Sign up to request clarification or add additional context in comments.

2 Comments

well in app.manifest file i have set <requestedExecutionLevel level="highestAvailable" UIAccess="true" />, it should allow to write, shouldn't it
@WatsMyName, it would work with level="requireAdministrator" (and you would get the UAC prompt when you start the app)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.