 |
|
|
 |
|
 |
I tried your code, and received a return value of 2. What does it mean?
A description of the return values would be nice!
|
|
|
|
 |
|
 |
سلام
پست جالبی بود ممنونم ازتون
|
|
|
|
 |
|
|
 |
|
|
 |
|
 |
Hi Guys,
This post was very useful for me and i even made a tool for easy folder sharing. It can be found in the codeplex in the below link.
http://easyshare.codeplex.com/
Please try it and leave feedback. Thanks for the post again.
MJ
|
|
|
|
 |
|
 |
Hi. I really like this article, congratulations. Just one point of concern, what will the folder rights be, read_only, read and write, etc.?
Wamuti: Any man can be an island, but islands to need water around them!
Edmund Burke: No one could make a greater mistake than he who did nothing because he could do only a little.
|
|
|
|
 |
|
 |
I searched all over internet, seems like nobody actually knows how to read share permission!
dev
|
|
|
|
 |
|
|
 |
|
|
 |
|
 |
Thanks for this useful article.
|
|
|
|
 |
|
 |
How do you check if the folder is shared? I don't want to display the error message "Unable to share directory" if the folder is already set for sharing.
Thanks for your help.
|
|
|
|
 |
|
 |
Another advanced Property of shared folders is the Caching. Any idea how to set this?
|
|
|
|
 |
|
 |
using System.Security.AccessControl;
using System.Security.Principal;
...
NTAccount account = new NTAccount("Domain Users");
SecurityIdentifier sId = (SecurityIdentifier)account.Translate(typeof SecurityIdentifier));
DirectorySecurity dirSec = new DirectorySecurity();
FileSystemAccessRule accessRule = new FileSystemAccessRule(sId,
FileSystemRights.FullControl, InheritanceFlags.ObjectInherit |
InheritanceFlags.ContainerInherit, PropagationFlags.None, AccessControlType.Allow);
dirSec.AddAccessRule(accessRule);
Directory.SetAccessControl("c:\YourSharedFolder", dirSec);
---
RandyStimpson.blogspot.com
Bug-Tracking-Guidelines.com
|
|
|
|
 |
|
 |
I've been trying to set permissions on a shared folder programmatically for some time but I haven't found the way.
The code you offer is very similar to what I've been trying, but it still doesn't actually set the permissions on the share. At least not for me.
If you look at the folder's Properties -> Sharing tab -> Permissions, nothing has changed.
Only in the Properties -> Permissions. But these are different.
Isn't this only really setting the permissions for a local user?
|
|
|
|
 |
|
 |
You're right, it shows how to set "NTFS Folder permission", not "Share Access/Permission"
That's misleading.
dev
|
|
|
|
 |
|
 |
Following your way, full control is given to all users. Is there any way to limit it to read-only? (I have the same problem using net share command line tool).
|
|
|
|
 |
|
 |
Hi!
When using your code (or my own code also using WMI) creating a share fails in some cases with error code 9 (illegal name). I cannot tell the reason why this error occurs. I can reproduce this error when I use a certain share name and a certain folder. When I use a different folder sometimes it works and sometimes it doesn't. When I use a different share name sometimes it works and sometimes it doesn't. And it doesn't matter if the folder existed before running the application or if it was created by the application. Under these circumstances this method of sharing folders (WMI) cannot be used in productive software!
Any idea? Or is there an alternative way, using native .NET? With unmanaged C++ I could use NetShareAdd, an SDK function... Perhaps there is a .NET aquivalent?
Best regards,
Andromeda Shun
|
|
|
|
 |
|
 |
Good Job, but how would I delete a share from a remote pc?
If anyone can help thanks (Newbie in .net).
|
|
|
|
 |
|
 |
Nice! I never new you could do that with WMI.
BTW, MgmtClassGen in the SDK is a life saver when it comes to dealing with WMI objects. It gets rid of the pain that comes with late-binding.
|
|
|
|
 |
|
 |
thanks
QHN_PROF@Yahoo.com
|
|
|
|
 |
|
|
 |
|
 |
Just ignoring all exceptions is bad, but even ignoring your own exception is even worse
|
|
|
|
 |
|
 |
I Commented Catch Execption to show you how can you use it!;P
QHN_PROF@Yahoo.com
|
|
|
|
 |
|
 |
it's really useful for me!
Thanks You!
|
|
|
|
 |