Click here to Skip to main content
15,919,479 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
I would like to know if there is any particular way to access a database which is stored in a shared-password-protected folder. I would like to access the folder by providing the username and password in the program itself.

The solution in either C# or VB6 (if possible) would be really the best thing...

Thank you


If you're in a Windows environment the access privileges should be handled via Active Directory. As SA pointed out, no reason to store passwords or user names in programs.

Also another thing. Is the database Access? If not and it's for example SQL Server then you don't need (or to be precise you must not have) access to the folders containing the database.
Share this answer
ankitjoshi24 5-Apr-11 15:46pm    
I am in Windows environment and yes the access privileges are handled. But I was just wondering if it is possible to get through a password protected folder.

The database is of no concern to me right now. I am able to access to through any password protected database like MS Access or SQL

It doesn't matter, I just wanted to get through a password protected folder.
Wendelius 5-Apr-11 15:56pm    
If I understood your question correctly, hopefully not. If there would be a hole in the security system I'd bet there would be quite a lot of angry IT people :)

What I meant with the database question was that only in Access (and few other legacy products) you need the actual privilege to modify the database file. In all real database server you don't even know the files nor do you see them.
ankitjoshi24 5-Apr-11 16:01pm    
You got it to a certain extent but you confused me a little bit :|

The security thing is of a less concern currently. The database being used is MS Access and yes, I have set the appropriate privileges for it.
Dave Kreskowiak 5-Apr-11 15:56pm    
Considering Windows natively have password protected folders in a domain environment, how this is being accomplished will directly dictate if it's possible to do by code and what you have to do, if anything.

Windows does support treating .ZIP files as a folder, even password protected ZIPs, but you do not get a username prompt, only a password.
ankitjoshi24 5-Apr-11 16:00pm    
I am trying to access the folder over LAN and in LAN (for Windows environment), when you try to access a folder shared by another computer, you need username and password to access that folder. That's why I asked the question.
If it would be possible, it would be a very weak protection. Nobody in clear mind won't store non-ciphered passwords anywhere — they are never needed for authentication.

To understand how to store authentication (it that is what your second question is about), learn Assymetric ciphering:[^], as well as RSA:[^]. It will give you a good idea. Why RSA? One reason is: it is fully implemented in .NET, see System.Security.Cryptography.RSA.

Share this answer
ankitjoshi24 5-Apr-11 15:34pm    
Thanx for the help SA so you mean that this is not possible at all????

Or do you have any suggestions which I could use to do something similar and keep my database protected???

Thanx again.

Sergey Alexandrovich Kryukov 5-Apr-11 15:43pm    
Yes, I think it is impossible in principle, unless you want to go in for password cracking which may require enormous resources.

As to the second part of your follow-up question -- please see my updated Answer.
ankitjoshi24 5-Apr-11 15:44pm    
I will go through the links. Thanx

Gonzoox 5-Apr-11 15:44pm    
Let me try to understand this, first what kind of database? if it's SQL Server, Oracle or something similar why not use the security it has built in, even with access you can create a security file for it to limit who can access it
ankitjoshi24 5-Apr-11 15:56pm    

The database is of no concern, I just want to get through the password-protected-shared folder using either C# or VB6

I have used the access control which is the built-in feature of Windows OS but just that since the folder would be accessed through the network and would required username and password to be accessed, so I was wondering to find a way to do that through the program

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900