I have written a windows forms application. Before I run the form, I write the startup time to a log textfile. This is done in the Program.Main() method.
When I run the program, everything works perfect.
But now I want to start the application on windows logon. So I have written the path+exe-name of the application in LM/Software/Microsoft/Windows/Currentversion/Run. But when I log on to windows, an UnauthorizedAccessException is thrown with the following stack trace:
<small>System.IO.__Error.WinIOError(Int32, System.String)
System.IO.FileStream.Init(System.String, System.IO.FileMode, System.IO.FileAccess, Int32, Boolean, System.IO.FileShare, Int32, System.IO.FileOptions, SECURITY_ATTRIBUTES, System.String, Boolean, Boolean)
System.IO.FileStream..ctor(System.String, System.IO.FileMode, System.IO.FileAccess, System.IO.FileShare, Int32, System.IO.FileOptions)
System.IO.StreamWriter.CreateFile(System.String, Boolean)
System.IO.StreamWriter..ctor(System.String, Boolean, System.Text.Encoding, Int32)
System.IO.StreamWriter..ctor(System.String, Boolean</small>
Can anyone tell me what I am missing here?