The .NET methods aren't working inside custom scripts


Custom .NET scripts embedded into the FlexiCapture 12 Rules, stages, event handlers, that should work with files, directories, threads sometimes are not executed correctly.


To properly execute the code that works with files/directories/threads, the user under which the Processing Station service is running, should have the permissions to access the objects used in such scripts.

For example:

StreamWriter class of the System.IO namespace works with files and directories. 

Here is a code snippet:

using System;

using System.Net;

using System.Net.Mail;

using System.IO;

using System.Collections.Generic;

    StreamWriter sw = new StreamWriter("C:\\temp\\Test.txt",true);

    //Write a line of text

    sw.WriteLine("Hello World!!");

    //Write a second line of text

    sw.WriteLine("From the StreamWriter class"+ docWithErrors.ToString());

    //Close the file


If the Processing Station is run under Network Service:


then the folder "C:\temp" and file "Test.txt" used in the script should have read & write permissions granted to the Network Service. 

Have more questions? Submit a request



Please sign in to leave a comment.