Skip to content

Instantly share code, notes, and snippets.

@smith-kyle
Last active Aug 29, 2015
Embed
What would you like to do?
public string[] getCurrentCart()
{
return GetStringFromFile("shoppingCart.txt");
}
public string[] GetStringFromFile(string fileName)
{
string fLocation = Path.Combine(HttpRuntime.AppDomainAppPath, @"App_Data"); // From server root to current
fLocation = Path.Combine(fLocation, fileName); // From current to App_Data
if (!File.Exists(fLocation))
{
return null;
}
using (StreamReader sr = File.OpenText(fLocation))
{
string[] s = System.IO.File.ReadAllLines(fLocation);
return s;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment