Sorry for the dumb question, but I'm trying to use File.Exists to check if a file exists in a Virtual Folder '~/XML/Test.xml/', but no matter what ever I try the file isn't detected. I've tested the basic C# code to test the file in @"C:\test.xml" and this works fine. Is there a better solution other than File.Exists that might work?
Example Code:
using System.IO;
string path = "~/XML/Test.xml";
if (File.Exists(path))
{
textBox1.Text = "File does exist";
}
else
{
textBox1.Text = "File does not exist";
}
Jaish MathewsPosted Apr 5, 2010, 12:34 PM
using System.IO;
string path = Server.MapPath(@"XML\Test.xml")
if (File.Exists(path))
{
textBox1.Text = "File does exist";
}
else
{
textBox1.Text = "File does not exist";
}