Reputation: 902
I am trying to make a connection via HttpWebRequest. I am reading url links from a text file. However, I am getting 'System.UriFormatException' error.
I have tried to add http:// in front of the url links in my text file. But the result is the same.
What can be the solution?
Upvotes: 4
Views: 40805
Reputation: 716
If the error only occurs when reading the values from a file, but not when assigned directly to a string
variable, then I'm guessing that there are extra characters being read (quotes, escaped characters, carriage-return/line feeds, etc).
Try reading the first value into a string
, and then comparing that to what you expect in the explicit string
value. Any differences should be obvious after that.
Upvotes: 10