I am working on a multilingual C# website . I have written a databaselanguages File and Languages class. In this class I put all strings in the appropriate language. By default, the language is Dutch, unless there is a cookie. Before i was using the language class I had it written in default,aspx.cs and requested the cookie like this:
Context.Request.Cookies ["lancookie"];
If the language was changed, I changed the cookie and reload the page. In the language class I use:
HttpContext.Current.Request.Cookies ["lancookie"].Value;
If I change the language, then it takes a few minutes before it also simply loads. What can I do to trigger the cookie?
public class Language
{
public static string getLanCookie ()
{
lancookie string = string.Empty;
if (HttpContext.Current.Request.Cookies ["lancookie"]. Value! = null)
{
lancookie HttpContext.Current.Request.Cookies = ["lancookie"]. Value;
}
else
{
lancookie = "Dutch";
}
lancookie return;
}
public static string language = getLanCookie ()
public static string Home = Language ("Home", language);
public static string end = Language ("The End", language);
public static string Subject = Language ("Box", language);
}