简体   繁体   中英

Set write permissions for my program to folder access

I have build a program in Visual Studio. The program creates a logfile and writes into it while the program is running through log4net. Therefore I should set write permissions for my program-folder regardless which user works with the program.

When i am accessing my application it throws me error as

File Access denied

So what i have done it i have given iis_users admin rights there by it works fine...

but my problem is with out setting that rights i should able to run my application through iis

So for i have done

1) Created app.manifest file with code as

 <requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3">
        <!-- UAC Manifest Options
            If you want to change the Windows User Account Control level replace the 
            requestedExecutionLevel node with one of the following.

        <requestedExecutionLevel  level="asInvoker" uiAccess="false" />
        <requestedExecutionLevel  level="requireAdministrator" uiAccess="false" />
        <requestedExecutionLevel  level="highestAvailable" uiAccess="false" />

            Specifying requestedExecutionLevel node will disable file and registry virtualization.
            If you want to utilize File and Registry Virtualization for backward 
            compatibility then delete the requestedExecutionLevel node.
        -->
         <requestedExecutionLevel  level="asInvoker" uiAccess="false" />
        <requestedExecutionLevel  level="requireAdministrator" uiAccess="false" />
        <requestedExecutionLevel  level="highestAvailable" uiAccess="false" />

      </requestedPrivileges>

but this does not help me to solve this problem

First, you shouldn't be doing that - I mean, writting logs into your program folder. That's what TEMP folders are for.

That said, I think one way to set permission for a file inside your program folder will be to do it in custom action of setup.

Here is a similar question: How to give Read/Write permissions to a Folder during installation using .NET

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM