Is there a way to change the owner of the saved file using IIS on the Windows server? Easy Better It does not make any difference either to save the file or to change the file owner because the file has already been saved in the disk. An example in ASP.NET is very auspicious.
In theory it should be quite straight forward. You should be able to do something to change the ownership of an existing file:
string domain = "domain"; String user = "user name"; File info info = new fileinfo (@ "c: \ test.txt"); File security protection = info.GetAccessControl (); System.Security.Principal.NTAccount newOwner = New system. Security. Principal. Nx account (domain, user); Security.AddAccessRule (New FileSystemAccessRule (new article, file systemwrite. Full control, access control type approval)); Security.SetAccessRuleProtection (True, False); Security.SetOwner (newOwner); Info.SetAccessControl (security);
In practice though it does not really work due to a limit that Windows imposes. Windows will not allow you to change the file owner except the existing user or administrator group.
When it kills the last line, you will get an exception, "Security Identifier is not allowed to be the owner of this object".
Googling suggests that working during this problem can be possible, but when I tried in the past, I have failed to work to do the work. I would be very interested to hear if anyone has successfully achieved the job.
Comments
Post a Comment