有谁知道!
我用FileStream类的对象在指定虚拟目录创建一个XML文件的时候。程序为什么同时在SYSTEM32文件夹下也自动创建了一个相同的文件?
string path = @"..\..";
FileStream fs =new FileStream(fileName,FileMode.CreateNew);
doc.Save(Server.MapPath(path))
有知者,请告知!谢谢!

解决方案 »

  1.   

    string path = Server.MapPath("../");
    FileStream fs =new FileStream(fileName,FileMode.CreateNew);
    doc.Save(Server.MapPath(path));
      

  2.   

    因为filestream的构造函数的第一个参数接受的是一个服务器的物理路径,默认当前物理路径应该是x:\windows\system32\intsrv   ../自然也就是system32了
      

  3.   

    那个构造函数有重载的方法!
    我传的不是路径!而是文件名称
    最后doc.Save(Server.MapPath(path))的时候才指定虚拟路径
      

  4.   

    string path = @"..\..";
    FileStream fs =new FileStream(fileName,FileMode.CreateNew);
    doc.Save(Server.MapPath(path))
    --------
    你上面这样写,创建的程序与保存的语句,两者之间,根本一点关系都没有.怎么会有正确的结果呢?
    string path = Server.MapPath(@"../..") + "\\" + fileName;
    FileStream fs =new FileStream(path ,FileMode.CreateNew);
    doc.Save(path)
    这样写,保证会出现正确的结果.
      

  5.   

    string path = Server.MapPath(@"../..") + "\\" + fileName;
    FileStream fs =new FileStream(path ,FileMode.CreateNew);
    doc.Save(path)
      

  6.   

    string path = Server.MapPath(@"../..") + "\\" + fileName;
    doc.Save(path)