Answer the question
In order to leave comments, you need to log in
Do symbols appear during Rest request?
Wrote a request to the site
public static string UTCtime()
{
string url = "http://worldtimeapi.org/api/timezone/Europe/Berlin";
HttpWebRequest httpWebRequest = (HttpWebRequest)WebRequest.Create(url);
HttpWebResponse httpWebResponse = (HttpWebResponse)httpWebRequest.GetResponse();
string response ;
StreamReader streamReader = new StreamReader(httpWebResponse.GetResponseStream());
response = streamReader.ReadToEnd();
streamReader.Close();
IRoot myDeserializedClass = JsonConvert.DeserializeObject<IRoot>(response);
string[] UTC = myDeserializedClass.utc_datetime.Split('.');
string UTCg = UTC[0].Replace(":","%3A");
Console.WriteLine(UTCg);
return UTCg;
}
2021-09-07T19%3A07%3A10.
2021-09-07T19%3 25 A07%3 25 A10.
Answer the question
In order to leave comments, you need to log in
string UTCg = UTC[0].Replace(":","%3A");
Just remove this and other lines where escaping is done by hand.
When sending a request, the http client itself shields everything as it should.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question