Hi,
Is this code considered thread safe even though multiple threads may be polling the directory for files on the webserver at once?
Thanks, Mike
//Get a testimonial
virtualRoot = HostingEnvironment.ApplicationVirtualPath;
configuration = WebConfigurationManager.OpenWebConfiguration(virtualRoot);
pathToNewsDirectory = configuration.AppSettings.Settings["VanHinoWeb.news.dir"].Value;
fileListing = Directory.GetFiles(pathToNewsDirectory, "*xml");
int index = generator.Next(0, fileListing.Length);
//Put it into XML and get data into string array to return
testimonialReader = new XmlTextReader(fileListing[index]);
testimonialReader.ReadToFollowing("quote");
testimonialData[0] = testimonialReader.ReadString();
testimonialReader.ReadToFollowing("author");
testimonialData[1] = testimonialReader.ReadString();
testimonialReader.ReadToFollowing("authorTitle");
testimonialData[2] = testimonialReader.ReadString();
return testimonialData;
}