开发者

trying to write to c:\temp in my console app

I have a very simple console ap开发者_如何转开发p where I'm using

dataset.WriteXml(@"c:\temp") 

but I'm getting message "Access Denied". What do I need to do?

Using Visual Studio 2008 on XP Pro.


You're trying to write to "c:\temp" which I suspect is a directory. Try:

dataset.WriteXml(@"c:\temp\dataset.xml")


If you're just trying to create a temporary file, rather than using C:\Temp, which may not be writable depending on user privileges, use Path.GetTempFileName(). This will return a filename in the user's \AppData\Local\Temp directory, which the user can write to.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜