I have a c# application
try
{
using (var client = new WebClient())
{
client.DownloadFile(url, name);
return true;
}
}
catch (Exception e)
{
Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo("en-US");
Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("en-US");
Logger.Error("Error inside DownloadFile");
Logger.Error(e.message);
Logger.Error(e.InnerException);
}
but i get error in non readable format
Error inside DownloadFile Œfi∑®¡¨Ω”µΩ‘∂≥Ã∑˛ŒÒ∆˜ System.Net.Sockets.SocketException (0x80004005): ”…”⁄ƒø±Íº∆À„ª˙ª˝º´æ‹æ¯£¨Œfi∑®¡¨Ω”°£ 108.160.165.189:443 at System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddress socketAddress) at System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure, Socket s4, Socket s6, Socket& socket, IPAddress& address, ConnectSocketState state, IAsyncResult asyncResult, Exception& exception)
The message in the exception is created when it's first thrown and that will be in whatever culture the code is compiled under. You cannot change this.
As this is WebClient
the only solution is to make sure you have the English language version of .NET installed.
User contributions licensed under CC BY-SA 3.0