1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39
| void Application_BeginRequest(object sender, EventArgs e)
{
Response.Expires = -1;
Response.CacheControl = "no-cache";
Response.AddHeader("Pragma", "no-cache");
Response.ExpiresAbsolute = DateTime.Now.Date;
}
// Ce morceau de code a été rajouté plus tard
void Application_PreRequestHandlerExecute(object sender, EventArgs e)
{
try
{
connexionBDD lng_con = new connexionBDD();
string lng_SQL = "SELECT CULTURE_ID\n" +
"FROM " + lng_con.PMBase + ".dbo.LNK_PAYS_LANGUE\n" +
"WHERE INDEX_LANGUE = " + HttpContext.Current.Session["langue"];
System.Data.SqlClient.SqlConnection lng_ACSDB = lng_con.ouvrirBDD();
System.Data.SqlClient.SqlCommand lng_SQL_Commande = new System.Data.SqlClient.SqlCommand(lng_SQL, lng_ACSDB);
System.Data.SqlClient.SqlDataReader lng_SQL_Resultat = lng_SQL_Commande.ExecuteReader();
string cultureInfo = System.Globalization.CultureInfo.CurrentCulture.Name;
if (lng_SQL_Resultat.Read())
cultureInfo = lng_SQL_Resultat["CULTURE_ID"].ToString();
lng_SQL_Resultat.Close();
lng_con.fermerBDD();
System.Threading.Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo(cultureInfo);
}
catch
{
System.Threading.Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo("fr-FR");
}
} |
Partager