Invalid Uri: Uri Schema Invalid

I am trying to establish a connection through HttpWebRequest. I am reading url links from a text file. However, I get the error "System.UriFormatException".

I tried adding http: // in front of url links in a text file. But the result is the same.

What could be the solution?

+4
source share
2 answers

If the error occurs only when reading values ​​from the file, but not when assigning the string variable directly, then I assume that additional characters are read (quotation marks, escaped characters, carriage return / line channels, etc.).

Try reading the first value in string , and then compare it with what you expect in the explicit value of string . Any differences should be apparent after this.

+6
source

Without looking at the code, it is impossible to say what you are trying to do. But you can start by examining the Message property of the UriFormatException class. Message is a string explaining the reason for the exception.

+1
source

All Articles