exception question?

  • Thread starter Thread starter Leon
  • Start date Start date
L

Leon

how do I get just the "System.Exception: The subdomain does not exist"
message and not the following from a unhandle exception?

System.Exception: The subdomain does not exist
at vip.header.Page_Load(Object sender, EventArgs e) in
c:\inetpub\wwwroot\vip\index\controls\header.ascx.vb:line 92
at System.Web.UI.Control.OnLoad(EventArgs e)
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Page.ProcessRequestMain()
 
how do I get just the "System.Exception: The subdomain does not exist"
message and not the following from a unhandle exception?

System.Exception: The subdomain does not exist
at vip.header.Page_Load(Object sender, EventArgs e) in
c:\inetpub\wwwroot\vip\index\controls\header.ascx.vb:line 92
at System.Web.UI.Control.OnLoad(EventArgs e)
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Page.ProcessRequestMain()

..Message property
 
So how can I get the just the message property in the Application_Error
event?

Sub Application_Error (ByVal sender As Object, ByVal e As EventArgs)

' Fires when an error occurs

'- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

'Dim LastException As String = Context.Server.GetLastError.ToString()

'Context.Server.ClearError()

'Response.Redirect("http://localhost/test/errorpage.aspx?Err=" &
Server.UrlEncode(LastException))

End Sub
 
don't understand what you are doing, please explain!
Server.GetLastError().Message
Server => type: HttpServerUtility
GetLastError() => type: Exception

"Gaurav Vaish"
 
I got it!
Dim ex As Exception = Server.GetLastError.GetBaseException

Dim msg As String = ex.Message

"Gaurav Vaish"
Application_Error(...)
{
Exception ex = Server.GetLastError();
string msg = ex.Message;
}
 
Back
Top