exception question?

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()
 
C

Craig Deelsnyder

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
 
L

Leon

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
 
L

Leon

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

"Gaurav Vaish"
 
L

Leon

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;
}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,982
Messages
2,570,185
Members
46,736
Latest member
AdolphBig6

Latest Threads

Top