Well I was able to isolate the problem here.
To read all files in my web projects App_Data Folder, I deleted the project file and made a new project. I was now able to read XML and HTML template files, and write log files.
So Now I still get the System.Security.Principal error reading the INI file. So I changed the trust from medium to full to read my INI file. Now I can read the file, but the GetPrivateProfileString still bombs.
So I changed the way I referenced the Kernel32.dll
<dllimport("kernel32.dll",> _
Private Shared Function GetPrivateProfileString(
ByVal lpApplicationName As String,
ByVal lpKeyName As String,
ByVal lpDefault As String,
ByVal lpReturnedString As System.Text.StringBuilder,
ByVal nSize As Integer,
ByVal lpFileName As String) As Integer
End Function
and changed
intCharCount = GetPrivateProfileString(Section, Key, [Default], objResult, objResult.Capacity, strFilename)
this -> GetString = Left(objResult.ToString, intCharCount)
to this -> GetString = objResult.ToString
Why the Left doesn't work I'm not sure. Guess I can't reference the Microsoft.VisualBasic in the header to use Left in that Library.
There was an article that says instead of using the stringbuilder, I should use a char array, but I wasn't able to figure out how to marshal it in VB.
So it was a combination of things here. It works, but it needs more polishing, I don't want any more problems here in the future. I welcome anyone's 2 cents here.