TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Rupesh Kahane
102
19.1k
4.2m
Set Authenticated Users permission to IIS site using C# code
Jun 15 2016 5:51 AM
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);
Reply
Answers (
1
)
Microsoft.Office.Interop.Excel Vs OpenXml Sdk
Conducting quizzes on various topics