System.UnauthorizedAccess Exception C# -


I currently have a compiled C # program, but whenever I run it, I get Windows to face the problem Does matter.

This is from a system. Unauthorized asset error, how can I access this error without any need from the user side and remove this error, because this program is being deployed to many people and I do not want it to be manually Fix with

Thanks

You can get the current user's application using the data folder Are there. Environmental variable APDATA Therefore, you can do something like this:

  string apadata = environment Gatefolderpath (environment specialfolder.app.dta) string configfile = path.combin (appadata, config file); Streamer writer writer = new streamer (configfile); Author. WrightLine ("My Configured Data"); Writer.Close ();  

You can also use this approach for the temporary folder. You can also generate a random file name using BCL functions. I think this is the path. GetTempFilename () .


Comments

Popular posts from this blog

asp.net - Change the driver in the connection string to a data source in VB.Net -

Getting started consuming web services in a Ruby on Rails 3 application -

objective c - iPhone and it's wireless area -