Question what do you do for request in Application_Start global asax i want to replace my path to my App_GlobalResources directory but i tried using request and it didn't work am i missing an assembly reference is there another way of doing it.
Updated Code:
List<string> languages = new List<string>
foreach (var file in Directory.EnumerateFiles(HttpContext.Current.Request.MapPath("App_GlobalResources"), "*.resx"))
{
string resource = Path.GetFileNameWithoutExtension(file);
if (resource.Length > 9)
{
string filename = resource.Substring(resource.IndexOf(".") + 1, resource.Length - resource.IndexOf(".") - 1);
RegionInfo regionInfo = new RegionInfo(filename);
if (!string.IsNullOrEmpty(filename))
{
llanguages.Add(filename);
} // error here
}
}
HttpContext.Current.Application.Add("Cultures", languages.ToArray());
List<string> languages = new List<string>();
foreach (var file in Directory.EnumerateFiles("C:\\Users\\KIRK\\Documents\\Visual Studio 2010\\WebSites\\WebSite2\\App_GlobalResources", "*.resx"))
{
string resource = Path.GetFileNameWithoutExtension(file);
if (resource.Length > 9) {
string filename = resource.Substring(resource.IndexOf(".") + 1, resource.Length - resource.IndexOf(".") - 1);
RegionInfo regionInfo = new RegionInfo(filename);
if (!string.IsNullOrEmpty(filename))
{ languages.Add(filename);
}
}
}
HttpContext.Current.Application.Add("Cultures", languages.ToArray());
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.