I think you must use try...catch.
you can show exceptions on textbox of current page use
catch.like this:
public void YourFunctionOrEvent(YourParametersList){
try{
// your code..
}
catch(Excepion ex){
this.YourEcvepionText.Text = ex.Message;
}
}
Response.Write(Server.GetLastError().Message) is a new
instance of page so there isn't a textbox.
you can add a textbox in your every page,and then you let
your page accept a parmeter names err,and then you can
send a parameter to current page.for example:
// this page name is a.aspx,there is a textbox in it
named txtErrMsg.
protected void Page_Error(parametersList){
Response.Redirt
(this.page...+"@err="+Server.GetLastError().Messag e);
}
public void Page_Load(PrametersList){
// your code..
if(this.Param["err"] != null){
txtErrMsg.text = Server.GetLastError().Message
Server.ClearError()
}
}
-----Original Message-----
I am using page level exceptions on some of my WebForms.
In most cases I am handling the errors simply like this:
Private Sub Page_Error(ByVal sender As Object, ByVal e
AsSystem.EventArgs) Handles MyBase.Error
Response.Write(Server.GetLastError().Message)
Server.ClearError()
End Sub
Instead of doing that I would like to send the error
infoto a textbox that is on the current form. Somthing like
this:
Private Sub Page_Error(ByVal sender As Object, ByVal e
AsSystem.EventArgs) Handles MyBase.Error
txtErrMsg.text = Server.GetLastError().Message
Server.ClearError()
End Sub
This doesn't work, the page displayed isalways just a
blank white page. Is there a way to do this?
Jerry J
.