Link to home
Start Free TrialLog in
Avatar of Murray Brown
Murray BrownFlag for United Kingdom of Great Britain and Northern Ireland

asked on

ASP.net Code error trapping not working

Hi

In my ASP.net web app the following code is causing an error that for some reason the error handling
code is not trapping. Also the rest of the code doesn't in the procedure does not run
                    Try
                        Session("oMessageToEmail") = xSellerUsername
                    Catch ex As Exception
                        Response.Write(ex.Message)
                    End Try

Open in new window

Avatar of Fernando Soto
Fernando Soto
Flag of United States of America image

I don't know if I will be able to help but what is the exception that is being thrown?
Avatar of Murray Brown

ASKER

It isn't throwing an exception. That is what is baffling me. The code just stops before        Catch ex As Exception
Don't know why assigning a value to Session("oMessageToEmail") would cause it to stop running. So when you say this, "The code just stops before Catch ex As Exception", where is the yellow instruction pointer pointing to, which line?
ASKER CERTIFIED SOLUTION
Avatar of Fernando Soto
Fernando Soto
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
As a test I ran the following code and the code did not get to the last line "Dim y as String = x"

             Dim x As String
                    Try
                        Session("oMessageToEmail") = xSellerUsername
                    Catch ex As Exception
                        x = ex.Message
                    End Try

                    Dim y As String = x

Open in new window

I was in release mode. Thanks for the help
Not a problem Murray, glad to help.