Reputation: 1695
I want to serialize some information I retrieve from the user in a small .NET 3.5 WinForms app to an XML file saved locally on his computer. Currently all the stations of the users intended to use this app have Windows 7 on them.
The thing is that the system won't just let me save the file anywhere, and I need a place that is both accessible through code (the system will allow saving there), and preferably is generic enough so that if tomorrow I want to run this app on a different version of Windows this path will still exist.
Any ideas?
Thank you.
Upvotes: 0
Views: 262
Reputation: 33149
You should be able to write to the local Application Data folder.
You can access it from C# as the Environment.SpecialFolder.LocalApplicationData
folder.
Another option would be Environment.SpecialFolder.Personal
.
Upvotes: 2
Reputation: 16148
You can have .net give the User's Userpath. Like "C:\Users\User\MyDocuments". Actually, that's what George's link is about. +1 for him.
Upvotes: 0