Hi .
I have a custom log file , and am trying to send the log file in email, if the file contains text "error" or "bcp copy out failed".
I have tried this code, but getting an error in the contains check.
string loggerfilepath = "c://abc.txt";
if ( ( File.ReadAllText(loggerfilepath).Contains("error", StringComparison.CurrentCultureIgnoreCase)) || (File.ReadAllText(loggerfilepath).Contains("BCP copy out failed", StringComparison.CurrentCultureIgnoreCase)))
{
// do other activity
}
How to fix this? Thanks