User-1766466902 posted
I want to access satellite assembly through below code. But every time it gives me the following error:
Could not find any resources appropriate for the specified culture or the neutral culture. Make sure "MyRes02.Res.hi-IN.resources" was correctly embedded or linked into assembly "App_Web_np6wjg1a" at compile time, or that
all the satellite assemblies required are loadable and fully signed.
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.Resources.MissingManifestResourceException: Could not find any resources appropriate for the specified culture or the neutral culture.
Make sure "MyRes02.Res.hi-IN.resources" was correctly embedded or linked into assembly "App_Web_np6wjg1a" at compile time, or that all the satellite assemblies required are loadable and fully signed.
-
Please tell me why I am getting this error. I have tried various method for resource generation & assembly Linking.
-
But could't access the assembly.
-
It works well if I access the resource file directly.
-
One thing more Please tell me, that When I put my resx file under "App_globalResources" It gives me error but when I put the ".Resex" outside the "App_gloabalResource" folder It works.
-
Why it behaves so.
1 using System;
2 using System.Data;
3 using System.Configuration;
4 using System.Web;
5 using System.Web.Security;
6 using System.Web.UI;
7 using System.Web.UI.WebControls;
8 using System.Web.UI.WebControls.WebParts;
9 using System.Web.UI.HtmlControls;
10 using System.Globalization;
11 using System.Reflection;
12 using System.Resources;
13 using System.Threading;
14
15 public partial class _Default : System.Web.UI.Page
16 {
17 private CultureInfo CI;
18 private CultureInfo CI1;
19
20 protected void Page_Load(object sender, EventArgs e)
21 {
22 if (!IsPostBack)
23 {
24 getCultureInfo("hi-IN");
25 DisplayResourceInfo("hi-IN");
26 }
27 }
28
29 private void getCultureInfo(string cultureName)
30 {
31 CI = new CultureInfo(cultureName);
32 Thread.CurrentThread.CurrentCulture = CI;
33 }
34
35 private void DisplayResourceInfo(string culName)
36 {
37 CI1 = new CultureInfo(culName);
38 Thread.CurrentThread.CurrentUICulture = CI1;
39 string FullCulName = "MyRes02.Res." + culName;
40 //ResourceManager RM = ResourceManager.CreateFileBasedResourceManager(FullCulName, Server.MapPath("App_GlobalResources"), null);
41 ResourceManager RM = new ResourceManager(FullCulName, Assembly.GetExecutingAssembly());
42 Label1.Text = RM.GetString("String1", CI1);
43 }
44 }
45