我已閱讀http://msdn.microsoft.com/en-us/library/ms149953.aspx並需要驗證我的GetLocalResourceObject
虛擬路徑是什麼。什麼是我的HttpContext.GetLocalResourceObject方法虛擬路徑?
C:
我的本地資源文件在位於我的電腦\的Inetpub \ wwwroot的\ GlobalX \輸入\ App_LocalResources文件
在此文件夾的所有語言該網站拉手我的資源文件( InputContactDetails.aspx.ro.resx,InputContactDetails.aspx.hi.resx等),以及默認的資源文件(InputContactDetails.aspx.resx)。
我在嘗試實現虛擬路徑字符串時收到錯誤消息。下面是我的問題的代碼行:
return '<%= HttpContext.GetLocalResourceObject("~/GlobalX/Input/App_LocalResources/InputContactDetails.aspx.resx", "ContactDetails.Text", new System.Globalization.CultureInfo("ro")) %>';
我試圖~/GlobalX/Input/App_LocalResources
作爲虛擬路徑等幾個排列,但我得到了同樣的錯誤。
如果有人能證明我做錯了什麼,我將非常感激。
以下是錯誤消息我得到:
The resource class for this page was not found. Please check if the resource file exists and try again.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.InvalidOperationException: The resource class for this page was not found. Please check if the resource file exists and try again.
Source Error:
Line 410: function languageContactPromptPhone(var_lcs) { Line 411: if (var_lcs == "af") { Line 412: return '<%= HttpContext.GetLocalResourceObject("~/GlobalX/Input/App_LocalResources/InputContactDetails.aspx.resx", "ContactDetails.Text", new System.Globalization.CultureInfo("ro")) %>'; Line 413: } Line 414: else if (var_lcs == "sq") {
Source File: c:\inetpub\wwwroot\GlobalX\Input\InputContactDetails.aspx Line: 412
Stack Trace:
[InvalidOperationException: The resource class for this page was not found. Please check if the resource file exists and try again.]
System.Web.Compilation.LocalResXResourceProvider.CreateResourceManager() +2785818 System.Web.Compilation.BaseResXResourceProvider.EnsureResourceManager() +24 System.Web.Compilation.BaseResXResourceProvider.GetObject(String resourceKey, CultureInfo culture) +15
System.Web.Compilation.ResourceExpressionBuilder.GetResourceObject(IResourceProvider resourceProvider, String resourceKey, CultureInfo culture, Type objType, String propName) +23
System.Web.HttpContext.GetLocalResourceObject(String virtualPath, String resourceKey, CultureInfo culture) +38
ASP.input_inputcontactdetails_aspx.__RenderContentInputContactDetails(HtmlTextWriter __w, Control parameterContainer) in c:\inetpub\wwwroot\GlobalX\Input\InputContactDetails.aspx:412
System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +109
System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) +8
System.Web.UI.Control.Render(HtmlTextWriter writer) +10
System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +27
System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +8991378
System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +25
System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +208
System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) +8
System.Web.UI.Control.Render(HtmlTextWriter writer) +10
System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +27
System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +8991378
System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +25
System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +208
System.Web.UI.UpdatePanel.RenderChildren(HtmlTextWriter writer) +256
System.Web.UI.UpdatePanel.Render(HtmlTextWriter writer) +37
System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +27
System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +8991378
System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +25
ASP.masterpages_masterinput_master.__RenderformMasterInput(HtmlTextWriter __w, Control parameterContainer) in c:\inetpub\wwwroot\GlobalX\MasterPages\MasterInput.master:140
System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +109
System.Web.UI.HtmlControls.HtmlForm.RenderChildren(HtmlTextWriter writer) +173
System.Web.UI.HtmlControls.HtmlContainerControl.Render(HtmlTextWriter writer) +31
System.Web.UI.HtmlControls.HtmlForm.Render(HtmlTextWriter output) +53 System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +27
System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +8991378
System.Web.UI.HtmlControls.HtmlForm.RenderControl(HtmlTextWriter writer) +40
System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +208
System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) +8
System.Web.UI.Control.Render(HtmlTextWriter writer) +10
System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +27
System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +8991378
System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +25
System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +208
System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) +8
System.Web.UI.Page.Render(HtmlTextWriter writer) +29
System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +27
System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +8991378
System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +25
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3060