Solved

Excel VB.netC drive access

Posted on 2014-04-08
5
272 Views
Last Modified: 2014-04-10
Hi

I tried to create a directory in the C drive on  client's machine
but access was denied. Is there a way to allow access or should I rather
use the Documents folder?

            If System.IO.Directory.Exists("c:\Program Files\KISS_Accounting") = False Then
                System.IO.Directory.CreateDirectory("c:\Program Files\KISS_Accounting")
            End If
            Dim FILE_NAME As String = "c:\Program Files\KISS_Accounting\Invoice_Number.txt"
0
Comment
Question by:murbro
  • 2
5 Comments
 
LVL 35

Assisted Solution

by:Kimputer
Kimputer earned 250 total points
ID: 39985792
In a normal user environment, the user has NO access to this folder (creating or modifying), while admins do (but with UAC prompt).
Therefore My Documents would be a better place to put files like that.
0
 

Author Comment

by:murbro
ID: 39985978
Thanks very much
0
 
LVL 40

Accepted Solution

by:
Jacques Bourgeois (James Burger) earned 250 total points
ID: 39987773
It depends on the type of file.

As is it going now, because most programmers do not know how to work in Windows, and My Documents has become a dump. My means documents that I created, not documents that are use internally by an application.

If the document is not recorded through a Save or Save As, it has no place in My Documents. The proper location for application files is in a C:\Users\<UserName>\AppData\<CompanyName>\<ApplicationName>

Since C:\Users\<UserName>\AppData can change depending on the operating system version and language, as well as for each user, you can retrieve it with the following call:

Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData)
0
 

Author Closing Comment

by:murbro
ID: 39991385
Thanks very much
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Article by: jpaulino
XML Literals are a great way to handle XML files and the community doesn’t use it as much as it should.  An XML Literal is like a String (http://msdn.microsoft.com/en-us/library/system.string.aspx) Literal, only instead of starting and ending with w…
I think the Typed DataTable and Typed DataSet are very good options when working with data, but I don't like auto-generated code. First, I create an Abstract Class for my DataTables Common Code.  This class Inherits from DataTable. Also, it can …
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…

920 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now