我filestream
用来写一个文本文档。除了文档被定向到错误的文件夹外,一切似乎都运行良好。
这是代码认为它应该创建文档的地方:
C:\Users\user2\Desktop\work\SuperBy\nop\NopCommerceStore\Administration\FedEx
FedEx
管理文件夹中不存在该文件夹。但是,如果我创建一个FedEx
文件夹并将其放在该Administration
文件夹中,.txt
文档就会相应地出现。
这是应该写入文档的文件夹的实际路径:
C:\Users\user2\Desktop\work\SuperBy\nop\NopCommerceStore\FedEx
我根本不明白代码是如何工作的以及如何更改它,真的需要一些帮助。
try
{
Order o = IoC.Resolve<IOrderService>().GetOrderById(orderID);
Customer ThisCustomer = o.Customer;
// Specify file, instructions, and privelegdes
string path = System.Web.HttpContext.Current.Request.PhysicalPath;
int index = path.LastIndexOf("\\");
string realPath = path.Substring(0, index + 1);
FileStream file = new FileStream(realPath + "/FedEx/" + orderID.ToString() + ".txt", FileMode.OpenOrCreate, FileAccess.Write);
}