how to access protected-pass folder
-
Hello everybody! I've a trouble and I can't solve :-( I've a PC with a local login/password shared folder and I need authenticate this user across winforms application to write a xml file. The question is, how do I authenticate this user? This user doesn't in AD group (is just a local user in machine).I need to do authentication manually. Somebody knows? Tks 4all!
LOL :)... I asked same thing but for certificates... and googling for you solution I think I found mine. Anyways... if you wish to control permissions use following code (example is for directory):
private static void GiveAccessToFolder() { string path = @"d:\testFolder\"; DirectorySecurity ds = Directory.GetAccessControl(path); ds.AddAccessRule(new FileSystemAccessRule("ARCHITECT\\testuser", FileSystemRights.FullControl, AccessControlType.Allow)); Directory.SetAccessControl(path, ds); }
You can find more examples over here. Enjoy friend! -
Hello everybody! I've a trouble and I can't solve :-( I've a PC with a local login/password shared folder and I need authenticate this user across winforms application to write a xml file. The question is, how do I authenticate this user? This user doesn't in AD group (is just a local user in machine).I need to do authentication manually. Somebody knows? Tks 4all!
NTFS doesn't support password protected folders. What kind of "shared folder" is this?? A password protected .ZIP file?
A guide to posting questions on CodeProject[^]
Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
2006, 2007 -
NTFS doesn't support password protected folders. What kind of "shared folder" is this?? A password protected .ZIP file?
A guide to posting questions on CodeProject[^]
Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
2006, 2007I assume he means the folder is a network share, and he needs a username/password to access it.
Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog "I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
-
I assume he means the folder is a network share, and he needs a username/password to access it.
Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog "I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
I was thinking the same thing, but I didn't want to assume. You know what happens when we assume around here! :laugh:
A guide to posting questions on CodeProject[^]
Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
2006, 2007 -
I was thinking the same thing, but I didn't want to assume. You know what happens when we assume around here! :laugh:
A guide to posting questions on CodeProject[^]
Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
2006, 2007Cmon... assume some solution to my certificate problem ;)
-
Cmon... assume some solution to my certificate problem ;)
I didn't answer because it's outside my relm of experience and I've run out of time to try to setup a test environment for this.
A guide to posting questions on CodeProject[^]
Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
2006, 2007 -
LOL :)... I asked same thing but for certificates... and googling for you solution I think I found mine. Anyways... if you wish to control permissions use following code (example is for directory):
private static void GiveAccessToFolder() { string path = @"d:\testFolder\"; DirectorySecurity ds = Directory.GetAccessControl(path); ds.AddAccessRule(new FileSystemAccessRule("ARCHITECT\\testuser", FileSystemRights.FullControl, AccessControlType.Allow)); Directory.SetAccessControl(path, ds); }
You can find more examples over here. Enjoy friend!Hello, tks for help. I tried to use this code, but I got a exception at this command DirectorySecurity ds = Directory.GetAccessControl(path); with message "Attempted to perform an unauthorized operation" Almost there..heheheeh
-
NTFS doesn't support password protected folders. What kind of "shared folder" is this?? A password protected .ZIP file?
A guide to posting questions on CodeProject[^]
Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
2006, 2007Well I created a shared folder, and I created also a user in the same machine (aka Maq048) the user that was created is xmlowner, then I've a Maq048\xmlowner user. In the folder I set permission to Maq048\xmlowner (full control), and now I want access this folder across network and save a file. But I don't know how to authenticate this user by C# application.
-
Well I created a shared folder, and I created also a user in the same machine (aka Maq048) the user that was created is xmlowner, then I've a Maq048\xmlowner user. In the folder I set permission to Maq048\xmlowner (full control), and now I want access this folder across network and save a file. But I don't know how to authenticate this user by C# application.
You are looking for something like this?
-
You are looking for something like this?
Yeah, something like this.. I created one user at pc01 and the same user at PC02 I impersonate my user at PC02 then I obtained to have access the protected folder in PC02 Tks 4all!!!! [:D]