I want to connect to another server using network.
So I write below code.
var webRequest = WebRequest.Create(@"10.3.4.56");
using (var response = webRequest.GetResponse())
{
using (var rd = new StreamReader(response.GetResponseStream()))
{
var soapResult = rd.ReadToEnd();
}
}
But there is error and it says
Invalid URI: The format of the URI could not be determined.
How to solve it?
The string you pass in to
WebRequest.Createneeds to be a valid Uri. TryWebRequest.Create("http://10.3.4.56").TIP! Use the static
Uri.IsWellFormedUriStringmethod to check if the URI string is valid.