C# vista does not giving access to create folder

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • babaidebnath
    New Member
    • Dec 2009
    • 6

    C# vista does not giving access to create folder

    In my project I have to create some files and directories into my app folder which is into program files. But in vista it is giving me error that I dont have access to create file. What should I do now for giving access ? Also it not let me access the registry !!
  • Subin Ninan
    New Member
    • Sep 2010
    • 91

    #2
    Embed an application manifest within your program with "requireAdminis trator" attribute.

    Edit "Secure Folder" with your ProjectName in following manifest file.
    Save it as "YourAppName.ex e.manifest" in your project directory.
    To embed this manifest in VS 2008 go to:
    Project Properties > "Applicatio n" tab > in "Manifest" comboBox select this manifest file.
    (if this manifest file is not shown in this comboBox, open solution explorer and right-click on this manifest file and select "Include in project".

    Code:
    <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
      <assemblyIdentity version="1.0.0.0" processorArchitecture="X86" name="SecureFolder" type="win32" />
      <description>SecureFolder</description>
      <trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
        <security>
          <requestedPrivileges>
            <requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
          </requestedPrivileges>
          <applicationRequestMinimum>
            <defaultAssemblyRequest permissionSetReference="Custom" />
            <PermissionSet class="System.Security.PermissionSet" version="1.3" Unrestricted="true" ID="Custom" SameSite="site" />
          </applicationRequestMinimum>
        </security>
      </trustInfo>
    </assembly>

    You need to have administrative rights to edit registry.

    Comment

    Working...