I am working on windows phone application. The user enters the ip and port of his server, database name, username and password. In the code i access the url entered by 'urltext.Text' But the error pops up 'Invalid URI format'. How to convert the data from textbox to valid URI format.
private void SendDataButton_Click(object sender, RoutedEventArgs e)
{
Uri myuri = new Uri(urltext.Text);
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(myuri);
Debug.WriteLine("Hello I m here");
Debug.WriteLine(request.GetType());
request.BeginGetResponse(new AsyncCallback(FinishWebRequest), request);
Console.ReadLine();
}
I want to take that entered url from the user and put in .Create() HttpWebRequest request = (HttpWebRequest)WebRequest.Create(myuri);
Please try this
Uri myuri = new Uri(urltext.Text);
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(myuri);
instead of
HttpWebRequest request =(HttpWebRequest)WebRequest.Create(urltext.Text);
hope it work for you