2011-08-25 7 views

Répondre

3

Utilisez la méthode System.Web.HttpUtility.UrlEncode().

string encode = HttpUtility.UrlEncode("© Alt+ 0169"); 
Response.Redirect("Page1.aspx?searchVal=" + encode); 
+0

J'utilise javascript comme ceci: -window.location.href = + strSearch et ce strSearch = © Alt + 0169 Si j'utilise Server.UrlEncode alors la chaîne a changé 'Test.aspx SearchVal =?. –

+1

S'il vous plaît vérifier ce lien - http://stackoverflow.com/questions/332872/how-to-encode-a-url-in-javascript – adatapost