In Asp.net i'm not able to catch any exception properly?
Posted
by Anand
on Stack Overflow
See other posts from Stack Overflow
or by Anand
Published on 2010-06-16T18:09:35Z
Indexed on
2010/06/16
19:02 UTC
Read the original article
Hit count: 207
In Asp.net (c#),i'm not able to catch exception(FileNotFoundException) properly... i don't know the reason..Actually File s not there..But catch statement fails to catch the exception.. here is the code..
try
{
System.Drawing.Image imgg1 = System.Drawing.Image.FromFile(Server.MapPath("").ToString() + "\\images\\img1.jpg");
}
catch (FileNotFoundException)
{
Response.Write("<script>alert('Please Select and upload Student's Photo');</script>");
}
© Stack Overflow or respective owner