2017-09-24 18 views
0

我創建了pdf文件,然後複製和有害生物到同一名稱(Test.pdf)的網站,然後在iframe中查看。當3個用戶同時執行此功能時012-1- IIS管理這種情況? 2-每個用戶看到自己的文件?許多用戶在同一時間以相同的名稱複製和害蟲pdf文件

當我運行的項目,它做得很好,但同時我擔心這些文件的混淆。 感謝您的幫助

string sourceLocation = @"" + Session["version_save_path"].ToString() + "\\" + Session["version_id"] + "_final.pdf"; 
       string dstnLocation = Server.MapPath(@"~/PDF/Test.pdf"); 
       System.IO.File.Copy(sourceLocation, dstnLocation, true); 
iframe1.Attributes["src"] = ("~/PDF/Test.pdf?var=" + DateTime.Now.ToString()); 
+0

每個用戶都會看到最新版本。如果將版本號放在目標文件名中,會更好。 用戶1查看他們的文件。 用戶2查看他們的文件。 如果用戶1刷新iframe,他們將看到用戶2文件。 –

回答

0

該文件將被多個用戶覆蓋。 文件路徑對於所有用戶都是相同的。 嘗試使用目標ID的唯一名稱。

string sourceLocation = @"" + Session["version_save_path"].ToString() + "\\" + Session["version_id"] + "_final.pdf"; 
      string dstnLocation = Server.MapPath(@"~/PDF/"+Session["version_id"]+"/Test.pdf"); 
      System.IO.File.Copy(sourceLocation, dstnLocation, true); 
iframe1.Attributes["src"] = ("~/PDF/Test.pdf?var=" + DateTime.Now.ToString()); 
+0

更改目標文件名時,在站點中創建了許多臨時文件。這需要刪除這些文件。 –

相關問題