c# - Simple WebClient not working: Customized cultures cannot be passed by LCID, only by name -
i trying send simple post
request url using webclient getting
an exception occurred during webclient request.
and in innerexception
customized cultures cannot passed lcid, name.
apparently there no discussion exception on internet.
here code:
public static void send(string message) { var url = "https://api.mailgun.net/v3/sandbox1ebb54bdb39044988d3c916d833769b7.mailgun.org/messages"; using (var client = new webclient()) { client.credentials = new networkcredential("api", "some_password"); var values = new namevaluecollection(); values["from"] = "mailgun sandbox <postmaster@sandbox1ebb54bdb39044988d3c916d833769b7.mailgun.org>"; var response = client.uploadvalues(url, values); var responsestring = encoding.default.getstring(response); reader.log(responsestring); } }
exception raised @ client.uploadvalues(url, values)
apparently, known issue older versions of .net (if system locale not us) https://connect.microsoft.com/visualstudio/feedback/details/1741767/compiler-error-customized-cultures-cannot-be-passed-by-lcid-only-by-name
moving .net 4.0 or higher solves issue.
Comments
Post a Comment