Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Turning a IP Address into a valid URI

I have been trying to navigate my webview element in my windows store app to '192.168.0.1' but for some reason the Uri class can not parse it, is there a way to make convert a IP Address into a Uri?

like image 635
Connor S Avatar asked Feb 07 '16 22:02

Connor S


2 Answers

You can also use UriBuilder and not have to manually add the "http://".

var builder = new UriBuilder("192.168.0.1");
var uri = builder.Uri;
like image 162
Brendan Avatar answered Sep 20 '22 16:09

Brendan


The answer to this is to add the prefix of the ip's protocol:

http:// or https://, for instance

new Uri("192.168.0.1") would have to be new Uri("http://192.168.0.1/")

Thanks to Bob Kaufman

like image 21
Connor S Avatar answered Sep 18 '22 16:09

Connor S