Ciao a tutti
in un sito multilingua utilizzo il metodo ajax di jquery per controllare se una username inserita è già presente o no. Jquery richiama un file handler che restiruisce un messaggio di errore nel caso la username è già presente:
public void ProcessRequest(HttpContext context)
{
context.Response.ContentType = "text/plain";
context.Response.Expires = -1;
string result = string.Empty;
string type = context.Request["type"];
string msg_error = string.Empty;
switch (type)
{
case "username":
string username = context.Request.Form["username"].Trim();
if (Users.UsernamePresente(username))
{
msg_error = Messaggi.ERR_USERNAME_PRESENTE;
}
break;
}
JavaScriptSerializer ser = new JavaScriptSerializer();
result = "{\"msg_error\":\"" + msg_error + "\"}";
context.Response.ContentType = "text/plain";
context.Response.Write(result);
}
Dove Messaggi.ERR_USERNAME_PRENSENTE restiruisce ilmessaggio di errore nella lingua scelta dall'utente:
Il problema è questo: se richiamo Messaggi.ERR_USERNAME_PRENSENTE all'interno dell'Handler mi restituisce sempre l'italiano.
Come mai?
Grazie mille