Hi tareq16278,
You need to use Exists method of File class and check the file is exists or not.
If not exists then set the default image url.
Code
C#
protected void Page_Load(object sender, EventArgs e)
{
if (System.IO.File.Exists(Server.MapPath("/Images/profile/max/123.jpg")))
{
Image1.ImageUrl = "/Images/profile/max/123.jpg";
}
else
{
Image1.ImageUrl = "/Images/Default.png";
}
}
VB.Net
Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Load
If System.IO.File.Exists(Server.MapPath("/Images/profile/max/123.jpg")) Then
Image1.ImageUrl = "/Images/profile/max/123.jpg"
Else
Image1.ImageUrl = "/Images/Default.png"
End If
End Sub