0
我試圖使用UNC路徑中的部分。我已經擴展了RazorViewEngine以包含路徑並正確註冊。當我加載視圖時,它顯示我包含的部分名稱正確列出的路徑,但仍顯示它無法加載視圖。如何從UNC路徑使用部分?
相關代碼:
public class MobileViewEngine : RazorViewEngine
{
public MobileViewEngine()
{
var viewLocations = new[] {
"\\uncserver\views\{0}.cshtml"
};
this.PartialViewLocationFormats = viewLocations;
this.ViewLocationFormats = viewLocations;
}
}
剃刀模板鏈接部分:
@Html.Partial("12\\1\\1.tpl")
錯誤:
The partial view '12\1\1.tpl' was not found or no view engine supports the searched locations. The following locations were searched: \\uncserver\views\12\1\1.tpl.cshtml
如果我訪問路徑它說,它沒有找到視圖,視圖就在那裏。 IIS正在以正確的權限運行,以查看此unc路徑。
任何想法?
這看起來應該起作用。謝謝! – Case 2011-04-14 04:29:03
我剛剛實現了這一點,它確實有效。該頁面上的示例代碼對我來說有點稀疏,但我能夠正確地工作。 – Case 2011-05-28 01:32:52