Skip to content

Instantly share code, notes, and snippets.

@smith-kyle
Last active August 29, 2015 13:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save smith-kyle/9863488 to your computer and use it in GitHub Desktop.
Save smith-kyle/9863488 to your computer and use it in GitHub Desktop.
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