I don't want to store an .XML file to a location on the hard drive (that I need to care about); I want it to be stored beneath the project's App_Data folder.
I will need a multitude of these, with names that will be calculated at runtime, such as "gramps_minority_201509.xml", "hijomio_carta_20151101_20151205.xml", etc.
I want to save the contents of DataTables to these XML files and later read from them when rendering pages (the XML file contents will populate grids on the pages).
XML files can be added at design time to the App_Data folder by selecting Add -> New Item... -> Visual C# -> Data from App_Data folder context menu, and then selecting "XML File" from the list there.
However, at that point you provide a name for the XML file; as noted, I need to names these "on the fly" and there will ultimately be many thousands of them.
So how can I create these XML files in code, saving the contents of DataTables to them?
Or perhaps saving to .json would be even better...
I would strongly advise you to use JSON instead of XML. There are a well know range of benefits of using JSON and I'm sure you know it. So I'll skip that.
To achieve what you want, you can use JSON.NET to serialize your DataTable into a JSON string very easily
public void Get()
{
string jsonString = JsonConvert.SerializeObject(datatable, Formatting.Indented);
string path = HttpContext.Current.Server.MapPath("~/App_Data/");
//Generate a filename with your logic..
string fileName = string.Concat(Guid.NewGuid().ToString(), ".json");
//Create the full Path
string fullPath = System.IO.Path.Combine(path, fileName);
//Create the json file
System.IO.File.WriteAllText(fullPath, jsonString);
}