Security error when trying to log to a text file
Created at 29 Jan 2022, 07:26
CT
Security error when trying to log to a text file
29 Jan 2022, 07:26
Hi I'm trying to log some data to text file, with the line of C# code.
File.AppendAllText("C:\\Log\\TestSMB01\\Log.txt", "Hello World" + Environment.NewLine);
The file exists, and it works fine, in a normal C# app, but not in cTrader Automate.
I'm getting the following error..
System.Security.SecurityException: 'Request for the permission of type 'System.Security.Permissions.FileIOPermission, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.'
Can anyone help me sort it out... thanks in advance.
ps. I'm new to cTrader Automate, and just learning how to do it.
firemyst
30 Jan 2022, 13:24
You need to grant your cBot access.
Alter the line you have for [Robot ... ] to include the following:
[Robot(TimeZone = TimeZones.UTC, AccessRights = AccessRights.FullAccess)]
@firemyst