Last active
August 29, 2015 13:57
-
-
Save smith-kyle/9863488 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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