我已阅读http://msdn.microsoft.com/en-us/library/ms149953.aspx并需要验证我的GetLocalResourceObject
虚拟路径是什么。
我的本地资源文件位于我的电脑上:
C:\inetpub\wwwroot\GlobalX\Input\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
作为虚拟路径和其他几种排列,但我得到了同样的错误。
如果有人能证明我做错了什么,我将不胜感激。
这是我收到的错误消息:
未找到此页面的资源类。请检查资源文件是否存在,然后重试。
说明:执行当前 Web 请求期间发生未处理的异常。请查看堆栈跟踪以获取有关错误及其源自代码的位置的更多信息。
异常详细信息:System.InvalidOperationException:找不到此页面的资源类。请检查资源文件是否存在,然后重试。
源错误:
第 410 行:函数 languageContactPromptPhone(var_lcs) { 第 411 行:if (var_lcs == "af") { 第 412 行:返回 '<%= HttpContext.GetLocalResourceObject("~/GlobalX/Input/App_LocalResources/InputContactDetails.aspx.resx", "ContactDetails.Text", new System.Globalization.CultureInfo("ro")) %>'; 第 413 行:} 第 414 行:否则 if (var_lcs == "sq") {
源文件:c:\inetpub\wwwroot\GlobalX\Input\InputContactDetails.aspx 行:412
堆栈跟踪:
[InvalidOperationException:找不到此页面的资源类。请检查资源文件是否存在并重试。]
System.Web.Compilation.LocalResXResourceProvider.CreateResourceManager() +2785818 System.Web.Compilation.BaseResXResourceProvider.EnsureResourceManager() +24 System.Web.Compilation.BaseResXResourceProvider.GetObject(String resourceKey , CultureInfo 文化) +15
System.Web.Compilation.ResourceExpressionBuilder.GetResourceObject(IResourceProvider resourceProvider, String resourceKey, CultureInfoculture, Type objType, String propName) +23
System.Web.HttpContext.GetLocalResourceObject(String virtualPath, String resourceKey, CultureInfoculture) +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 适配器) +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.Render(HtmlTextWriter writer
) 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 编写器)+173
System.Web.UI.HtmlControls.HtmlContainerControl.Render(HtmlTextWriter 编写器)+31
System.Web.UI.HtmlControls.HtmlForm.Render(HtmlTextWriter 输出)+53 System.Web.UI.Control.RenderControlInternal(HtmlTextWriter 编写器,ControlAdapter 适配器)+27
System.Web.UI.Control.RenderControl(HtmlTextWriter 编写器,ControlAdapter 适配器) +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 适配器) +27
System.Web.UI.Control.RenderControl(HtmlTextWriter writer,ControlAdapter 适配器)+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 适配器) +8991378
System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +25
System.Web.UI.Page.ProcessRequestMain(布尔 includeStagesBeforeAsyncPoint,布尔 includeStagesAfterAsyncPoint)+3060