Tech
Forums
Jobs
Books
Events
Interviews
Live
More
Learn
Training
Career
Members
Videos
News
Blogs
Login
Sign Up
Ask Question
1
Reply
Set Authenticated Users permission to IIS site using C# code
Rupesh Kahane
Jun 15 2016 5:51 AM
321
Reply
I have hosted one web application into my ISS. Now I don't to want to open iis and i would like to give Authenticated Users permission to my site using c# code. (I have created application using MVC 5 )
Currently it have Creator Owner permission. Please see bellow image for more info
I would like to set Authenticated Users permission to this as bellow
I have tried bellow code but it is not working fine
string publishPath = System.IO.Path.GetFullPath("publish");
string folder = Context.Parameters[publishPath];
SecurityIdentifier sid = new SecurityIdentifier(WellKnownSidType.AuthenticatedUserSid, null);
FileSystemAccessRule writerule = new FileSystemAccessRule(sid, FileSystemRights.Write, AccessControlType.Allow);
DirectorySecurity fsecurity = Directory.GetAccessControl(folder);
fsecurity.AddAccessRule(writerule);
Directory.SetAccessControl(folder, fsecurity);
Upload Source Code
Select only zip and rar file.
Post
Reset
Cancel
Answers (
1
)
Next Recommended Forum
Microsoft.Office.Interop.Excel Vs OpenXml Sdk
Conducting quizzes on various topics