5662 2
"Invalid URI: The format of the URI could not be determined" Error in C#

I am trying to run the below code in my asp.net MVC web-application, to get the URL of first image(<img>) in the HTML string, using the code below

       public static List<Uri> FetchLinksFromSource(string htmlSource)
        {
            List<Uri> links = new List<Uri>();
            string regexImgSrc = @"<img[^>]*?src\s*=\s*[""']?([^'"" >]+?)[ '""][^>]*?>";
            MatchCollection matchesImgSrc = Regex.Matches(htmlSource, regexImgSrc, RegexOptions.IgnoreCase | RegexOptions.Singleline);
            foreach (Match m in matchesImgSrc)
            {
                string href = m.Groups[1].Value;
                links.Add(new Uri(href)); //getting error here
            }
            return links;
        }

but I am getting this error "Invalid URI: The format of the URI could not be determined" when I run this code, here is the image of the error

...

Type
Question
5570 1
Ways to Convert Datatable to List in C# (with performance test example)
This article explains you the various ways to convert Datatable to List using C# with example, this article also shows a small performance test of linq and foreach method.
Type
Article
5548 1
Read excel file in C# (.XLSX or .XLS using OLEDB / EPPlus)
In this article, I am going to provide you code with explanation in C# to read excel file (xls) using OLEDB and using EPPlus in Console application.
Type
Article
5243 0
Interface in C# (With Example)
In this article, I have explained about Interface in C#, when to use it and why do we need it with an example.
Type
Article
4635 3
Using Entity framework join (EF join) to join two or more tables
In this article, I will explain how we can easily implement inner join on data of two or more tables using entity framework join (ef join) in ASP.NET MVC C#.
Type
Article


4310 1
Using a Hub instance not created by the HubPipeline is unsupported.

Hello, I am trying to call SignalR method from C# controller in asp.net MVC, but I am getting this error

Using a Hub instance not created by the HubPipeline is unsupported.

Here is the image of the error

...

Type
Question
4103 0
Exception handling in C# (With try-catch-finally block details)
In this article, I will explain you in detail about the concept of Exception handling in C# and how we can use try-catch block to handle errors with example.
Type
Article
3830 1
how to get location name (address) from lat-long in c#

How can I get location name(address) by entering latitude and longitude using google maps or any other API in C# .Net?

thanks 

...
Type
Question
3740 0
Ways to convert List into Datatable using C#
This article gives you quick solution & few ways to convert .ToList() or IEmuerable List data into DataTable using C#.
Type
Article
3610 2
Multiple actions were found that match the request: in web api C# ?

HI, I am trying to work with the Web API in C#, and when calling it using jquery I am getting the error "Multiple actions were found that match the request: in web API C#", so how to resolve this issue, here is my current code

...
Type
Question

Page 2 of 14