I need to check if a given URL (which is not necessarily prefixed with http or https) is HTTP or HTTPs.
Is this possible in C#?
If the user gives just www.dotnetperls.com without any prefix, I must be able to identify that it is an HTTP one. Tried the following,
HttpWebRequest request = (HttpWebRequest)WebRequest.Create("www.dotnetpearls.com");
string u = request.RequestUri.Scheme;
But this gives an Invalid URL error. It expects the protocol to be specified.