So part of my job is to write a file to iSeries IFS, or this path in particular \ServerIPAddress\home\test\ I have an ASP.NET web application to do this, and this is the code (C#) I use to write a simple text file to that directory:
string filename = @"\\SomeIPAdress\home\test\test.txt";
byte[] file = Encoding.ASCII.GetBytes("hello world");
FileStream fs = new FileStream(filename, FileMode.OpenOrCreate);
fs.Write(file, 0, file.Length);
fs.Close();
When executing this code, the program gives me "Access Denied" error
Exception Details: System.UnauthorizedAccessException: Access to the path '\SomeIPAddress\home\test\test.txt' is denied.
ASP.NET is not authorized to access the requested resource. Consider granting access rights to the resource to the ASP.NET request identity ...
I can access this directory \SomeIPAddress\home\test using windows file explorer using IBM UID and password, and I can create and edit a text file manually as well.
I know it has to have something to do with granting access right to my ASP.NET app by providing that UID and password, but I can't quite figure it out, and I have been stuck for few days.
Let me know if you need any extra information. Thanks for the help