내 페이지에 리소스 관리자를 만들고 리소스 파일에 저장된 일부 데이터를 사용하고 싶습니다.ASP.NET에서 리소스 관리자를 만드는 방법
System.Resources.ResourceManager myResourceManager = System.Resources.ResourceManager.CreateFileBasedResourceManager("resource",
Server.MapPath("App_LocalResources") + Path.DirectorySeparatorChar, null);
if (User.Identity.IsAuthenticated)
{
Welcome.Text = myResourceManager.GetString("LoggedInWelcomeText");
}
else
{
Welcome.Text = myResourceManager.GetString("LoggedOutWelcomeText");
}
을하지만 난 컴파일하고 내 로컬 서버에서 실행할 때이 유형의 오류를 얻을 : (default.aspx.resx 및 default.aspx.en.resx는)
코드는 다음과 같습니다 :
Could not find any resources appropriate for the specified culture (or the neutral culture) on disk. baseName: resource locationInfo: fileName: resource.resources 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.
예외 정보 : System.Resources.MissingManifestResourceException는 : 디스크의 지정된 문화에 대한 자원의 적절한 (또는 중립 문화를) 찾을 수 없습니다. baseName의 : 자원 locationInfo : 파일 이름 : resource.resources
소스 오류 :
행 89 : 다른 행 90 : { 행 91 : Welcome.Text = myResourceManager.GetString ("LoggedOutWelcomeText"); 92 번 라인 :} 라인 93 :
이 문제에 대해 저에게 도움을 주시기 바랍니다.
예, default.aspx.en.resx이 있고을 App_LocalResources에 default.aspx.resx도 이름이 "LoggedOutWelcomeText" – Bart
OK 거기 행되지만 이름 돈 ' CreateFileBasedResourceManager에 대한 호출로 말하는 'resource'로 시작하십시오. – Timores