简体   繁体   English

如何在aspx文件中访问本地资源

[英]How to access a local ressource in an aspx file

I'm a bit new to aspx (I have mostly don MVC in the past)and this may sound silly to most people, but I'm a bit stuck: I have a page, New.aspx located in a subfolder (Incident/New.aspx) and I need the access to a resource file for globalisation purpose. 我对aspx有点陌生(过去我大部分时间都没有使用过MVC),这对大多数人来说听起来很愚蠢,但是我有点卡住了:我有一个页面New.aspx位于子文件夹中(Incident / New.aspx),并且出于全球化目的,我需要访问资源文件。 So I have created a New.aspx.resx file in the App_LocalResources folder but it pops me an resource file not found when I call GetLocalResourceObject(mykey) in the page codebehind. 因此,我在App_LocalResources文件夹中创建了一个New.aspx.resx文件,但是当我在GetLocalResourceObject(mykey)的页面代码中调用GetLocalResourceObject(mykey)时,它为我弹出了一个找不到的资源文件。

Am I missing something ? 我想念什么吗?

尝试使用此方法获取全局资源数据。

globalresourcestring = (String)GetGlobalResourceObject("New.aspx.resx", "Key");

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM