Errore lingua in un file handler

martedì 26 marzo 2013 - 12.55
Tag Elenco Tags  C#  |  .NET 4.0

svipla Profilo | Senior Member

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 codice sorgente non è stato renderizzato qui
perchè non c'è sufficiente spazio.
Clicca qui per visualizzarlo in una nuova finestra

Il problema è questo: se richiamo Messaggi.ERR_USERNAME_PRENSENTE all'interno dell'Handler mi restituisce sempre l'italiano.

Come mai?

Grazie mille
Partecipa anche tu! Registrati!
Hai bisogno di aiuto ?
Perchè non ti registri subito?

Dopo esserti registrato potrai chiedere
aiuto sul nostro Forum oppure aiutare gli altri

Consulta le Stanze disponibili.

Registrati ora !
Copyright © dotNetHell.it 2002-2025
Running on Windows Server 2008 R2 Standard, SQL Server 2012 & ASP.NET 3.5