0
是否有可能在.NET解決方案中引用指向文件的新位圖而不給它提供完全限定的文件系統位置?試圖在Azure中運行而無需設置雲存儲。asp.net新文件位於ASP.NET解決方案的相對路徑和非完全限定的文件系統?
此代碼未能解析a.jpg ...我試過\ a.jpg,〜\ a.jpg等等。懷疑不是,而是問我只是爲了防止我在這裏丟失東西。
context.Response.Clear();
//Bitmap bitMapImage = new System.Drawing.Bitmap((@"P:\somedirectory\a.jpg"));
Bitmap bitMapImage = new System.Drawing.Bitmap((@"a.jpg"));
Graphics graphicImage = Graphics.FromImage(bitMapImage);
UPDATE:還試圖
Bitmap bitMapImage = new System.Drawing.Bitmap(HttpContext.Current.Server.MapPath("a.jpg"));
如果它是一個Web應用程序,你嘗試過使用Server.Mappath? – AContractor 2013-05-13 12:32:06
是的。這是行不通的:參數無效.. Bitmap bitMapImage = new System.Drawing.Bitmap(HttpContext.Current.Server.MapPath(「a.jpg」));嘗試了/a.jpg和〜/ a.jpg – o365spo 2013-05-13 16:02:40