I need to read the contents of the Web.Config and send them off in an email, is there a better way to do the following:
string webConfigContents = String.Empty;
using (FileStream steam = new FileStream(
Server.MapPath("~/web.config"),
FileMode.Open, FileAccess.Read, FileShare.Read))
{
using (StreamReader reader = new StreamReader(steam))
{
webConfigContents = reader.ReadToEnd();
}
}
I dont want to lock the file. Any ideas?
Edit - I need a raw dump of the file, I cant attach the file (Webhost says nay!), and im not looking for anything specific inside it