permissions - WPF Application not getting file access rights -


i have wpf app creates text files in own install directory. however, after uac prompt, windows vista , windows 7 users times still "file access failed" type errors. solution find executable in windows explorer , open compatibility tab under file properties , check "run administrator". terrible user experience i'm not sure how ensure app can secure these permissions without step being taken. not trying bypass uac prompts.

you can force app start admin rights (uac show it's dialog box anyway) embedding custom manifest (project properties -> build -> manifest).

manifest example (requestedexecutionlevel part importaint):

<?xml version="1.0" encoding="utf-8"?> <asmv1:assembly manifestversion="1.0"   xmlns="urn:schemas-microsoft-com:asm.v1"   xmlns:asmv1="urn:schemas-microsoft-com:asm.v1"   xmlns:asmv2="urn:schemas-microsoft-com:asm.v2"   xmlns:xsi="http://www.w3.org/2001/xmlschema-instance">     <assemblyidentity version="1.0.0.0" name="yourappname.app"/>     <trustinfo xmlns="urn:schemas-microsoft-com:asm.v2">         <security>             <requestedprivileges xmlns="urn:schemas-microsoft-com:asm.v3">                 <requestedexecutionlevel level="requireadministrator" uiaccess="false" />             </requestedprivileges>         </security>     </trustinfo>     <compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">         <application>             <!-- list of windows versions application designed work with. windows automatically select compatible environment.-->             <!-- if application designed work windows 7, uncomment following supportedos node-->             <!--<supportedos id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"/>-->         </application>     </compatibility> </asmv1:assembly> 

Comments

Popular posts from this blog

python - Scipy curvefit RuntimeError:Optimal parameters not found: Number of calls to function has reached maxfev = 1000 -

c# - How to add a new treeview at the selected node? -

java - netbeans "Please wait - classpath scanning in progress..." -