Ian Gallegos
Ian Gallegos

Reputation: 558

Compose URL for webView

I have a webView in xamarin called Browser and I should give it a URL.

        string ciao = "pizza";
        Browser.Source = "www." + pizza + ".it";

I have this code, how can I compose the URL?

Upvotes: 1

Views: 114

Answers (2)

Hichame Yessou
Hichame Yessou

Reputation: 2708

Use the Uri class.

string ciao = "pizza";
string it = "it";
Browser.Source = new Uri (string.Format ("http://www.{0}.{1}",ciao,it));

Upvotes: 2

Jason
Jason

Reputation: 89102

a URL needs a protocol

Source = $"http://www.{ciao}.com"

Upvotes: 1

Related Questions