using System;
namespace ASPNET {
public partial class ReadResourceValue: System.Web.UI.Page {
protected void Page_Load(object sender, EventArgs e) {
//In the Resource file properties. Set Build Action = Embedded Resource
string strResourceValue = GetResource("ResourceName");
}
public string GetResource(string strResourceKey) {
string strResult = string.Empty;
try {
if (!string.IsNullOrEmpty(strResourceKey)) {
//APPNET.MyResourceFile ASPNET = my project name & MyResourceFile = Resource file name
System.Resources.ResourceManager objResourceManager = new System.Resources.ResourceManager("ASPNET.MyResourceFile", typeof(ReadResourceValue).Assembly);
string value = objResourceManager.GetString(strResourceKey).ToString();
}
} catch (Exception ex) {
Console.Write(ex.ToString());
}
return strResult;
}
}
}This code is for to read resource file RESX file.