c# - In Asp.net i'm not able to catch any exception properly? -
In Asp.net (c #), I'm not able to catch exceptions (fileNET phosphate exception) ... I do not know the reason 'cause. The file is not really there .. but catching statement exception Fails .. Here is the code.
try {System.Drawing.Image imgg1 = system} Drawing.Image.FromFile (Server.MapPath (""). ToString () + " \\ images \\ img1.jpg "); } Catch (Filenotophound Exception) {Response. Wyit ("& lt; scripts & gt; alert ('Please select and upload the photo of the student'); ";); }
Are you sure that your exception?
You should try to replace FileNotFoundException only for the exception and check what the exception is.
Edit: Q1: In debug mode, what is the code to actually enter the catch session?
Can you restart that code (Ctrl + Shift + B in Visual Studio)?
You are actually typing a code that will be unsuccessful in the quote ending in:
WARNING ('Please select and upload the photo of the student');
View this in Syntax Highlighter
Warning ('Please select and upload the photo of the student');