0
Reply

Bubble event in C# from a dll to the ASPX page?

aphillips2k4

aphillips2k4

Aug 13 2004 12:40 PM
2.2k
In VB.Net, I am able to bubble an event very easy by doing this in my database class Public Event DatabaseError(ByVal msg As String) .... Try objConn = New SqlConnection(ConnectionString) objConn.Open Catch ex As Exception RaiseEvent DatabaseError(ex.Message) End Try and later calling it in my ASPX page. Whenever an error occurs, I get a white screen with the appropriate error. In C# I tried this in my database class try { SqlConnection objconn = new SqlConnection(ConnectionString); objconn.Open; } catch (Exception ex) { throw ex; } Base on examples I seen on the net. But when I execute my web app, I get a full .net error page that not only tell me connection was unsuccessful, it also reveals part of my code. Exception Details: System.Data.SqlClient.SqlException: SQL Server does not exist or access denied. Source Error: Line 27: catch (SqlException ex) Line 28: { Line 29: throw ex; Line 30: } Line 31: } Is there some sort of setting somewhere that controls this or is my C# syntax is wrong. It highlights the line 29. I don't want the users of the website to see all of this if an error occur.