Check the image type in c# asp.net mvc code example
Example 1: c# display image
OpenFileDialog open = new OpenFileDialog();
open.Filter = "Image Files(*.jpg; *.jpeg; *.gif; *.bmp)|*.jpg; *.jpeg; *.gif; *.bmp";
if (open.ShowDialog() == DialogResult.OK) {
pictureBox1.Image = new Bitmap(open.FileName);
textBox1.Text = open.FileName;
}
Example 2: c# how to get src from html img
string str = "<div> <img src=\"https://i.testimg.com/images/g/test/s-l400.jpg\" style=\"width: 100%;\"> <div>Test</div> </div>";
int start = str.IndexOf("<img src=\"") + 10;
string src = str.Substring(start, str.IndexOf("\"", start) - start);