OpenTextFile File_Dialog does not open in Gen 8.6 ASP.NET client
search cancel

OpenTextFile File_Dialog does not open in Gen 8.6 ASP.NET client


Article ID: 269288


Updated On:


Gen Gen - Workstation Toolset


I am trying to create a Gen 8.6 ASP.NET web based client which presents a file explorer that shows only Excel files from the user's PC then, after the user selects the file, inserts its data into a database table for loading onto the browser window.

I am willing to do something similar with the Gen OpenTextFile function for Excel files.
I tried OpenTextFile option File_Dialog and when testing the generated GUI Windows C application the file explorer was displayed. However, when testing an ASP.NET client the file explorer was not displayed.


Release : 8.6


Gen L1 Support tested code for OpenTextFile options File_Dialog and Filename for GUI/C and ASP.NET applications.
For GUI/C both options were successful.
However, under ASP.NET only the Filename option was successful and the File_Dialog option did not open any file explorer for file selection which matches the reported behaviour.

Gen Engineering advised that when the OpenTextFile option File_Dialog is used under ASP.NET the Gen runtime will attempt to call C# function OpenFileDialog. However, from their web research, it appears that OpenFileDialog will only display the results on the server where IIS is running and not on the client machine where the browser is being used. For example, the problem logged by a developer here:

In the meantime, the Gen developer had also tried to create a C# External Action Block (EAB) using the same OpenFileDialog function and although tests were successful under Visual Studio they received an error at runtime "Object reference not set to an instance of an object". Working in Visual Studio and not working under ASP.NET using IIS is also what the developer reported above.

1. In summary using OpenTextFile with File_Dialog will not be feasible under ASP.NET and the documentation for OpenTextFile Function has been improved to state that (i.e. "Note: For ASP.NET applications, OpenTextFile only works with the Filename option, not the File_Dialog option. This is because File_Dialog uses the C# class OpenFileDialog which only displays the file selection dialog box on the server where IIS is running and not on the client machine where the browser is being used.")

2. On the above Microsoft page, it is suggested to copy the file to the IIS server and then process it from there. That is along the same lines of a workaround that L1 Support had earlier provided via the use of the ASP.NET control FileUpload i.e. select a file using control FileUpload, save it to the IIS server and then use OpenTextFile to process the file on the server via its full path. See attached test model and README file.

Additional Information

Currently when running Toolset Consistency Check (CC) usage of OpenTextFile in an action diagram statement will show messages:
WARNING : ICCOO03W Function cannot be executed in ASP.NET applications.
WARNING : ICCOO05W Function is not multi-thread safe in C# or Java.

Relevant documentation pages:
Consistency Check Messages - ICCOO03W
Consistency Check Messages - ICCOO05W

ICCOO05W is in line with the comments about OpenTextFile not being thread safe for .NET under the Unsupported ASP.NET Web Client Features page - see "Unsupported File-Related Functions
However, ICCOO03W should not include an OpenTextFile check and it will be removed from the Toolset CC in the near future. The ICCOO03W documentation page has already been updated to remove the reference to OpenTextFile.


1689822709128__FileUpload_with_OpenTextFile_README.docx get_app get_app