简体   繁体   中英

CreateDirectory() and WriteXML - No Access (UnauthorizedAccessException)

I have the problem that I create a folder with CreateDirectory(@exportPath). The Problem is my i have no access to write in that created Folder with ds.WriteXml(exportPath);.

Is there a possible way to create rights to access with the CreateDirectory Method?

                    Directory.CreateDirectory(@exportPath);

                    ....

                    sqlDataAdapt = new SqlDataAdapter(sqlQuery, sqlCon);
                    DataSet ds = new DataSet();
                    sqlDataAdapt.Fill(ds);


                    ds.WriteXml(exportPath); 
                    ds = null;

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