System.Web.HttpContext

  • Thread starter Thread starter Rob Morgan
  • Start date Start date
R

Rob Morgan

For some reason I can't pass the Context to my remoting object. When I run
this the application just shows the thrown exception, it never sends the
Context it to the remoting server. If I only send the exception it works.
Any ideas appreciated

protected void Application_Error(Object sender, EventArgs e)
{
ODE.Enterprise.Exception.Common.IExceptionHandler exceptionHandler =
(ODE.Enterprise.Exception.Common.IExceptionHandler)
ODE.Enterprise.Exception.Common.ClassFactory.CreateInstance(typeof(ODE.Enter
prise.Exception.Common.IExceptionHandler));
exceptionHandler.RaiseError(Server.GetLastError().InnerException,
System.Web.HttpContext.Current);
}
 
Remoting an HttpContext is kind of like trying to remote a SQL connection -
how could it possibly work? The HttpContext holds a live connection to the
response stream as well as to the request stream - you can't
serialize/deserialize something like that.
 
I have never done this before. Anyway: I dont think HttpContext is
serializable. You can probably try sending the HttpContext.Current.Request
if you just want to get the current request.
 
Tell us perhaps more about what you need in this. I would pass only the
necessarty info as - as noted by Marina - it would be similar to remoting a
connection.

Perhaps could you use a web service ? What are you trying to achieve ?

Patrice

--
 
Make perfect sense, thanks

Marina said:
Remoting an HttpContext is kind of like trying to remote a SQL connection -
how could it possibly work? The HttpContext holds a live connection to the
response stream as well as to the request stream - you can't
serialize/deserialize something like that.


ODE.Enterprise.Exception.Common.ClassFactory.CreateInstance(typeof(ODE.Enter
 
I've made a remoting exception handler and I want applications to send it
enough information so we can route/track down the errors. I've got it
accepting Server.GetLastError().InnerException, and I wanted to include the
context information. Looks like I'm going to have to send it the Response,
Request, and Enviroment objects if that's possible. The smaller amount of
code that the applications have to use the better.

Thanks
 
Humm.. And what is the reason behind remoting the exception handler ? What
do you do with the information once you handler retrieved it ? If this is to
produce a trace message, you could perhaps produce the trace message and
sends directly this information to the handler rather than to send this and
create the trace message at the other end.

Also what benefit are you trying to reach by remoting the handler ?

Patrice

--
 
We will probably email it to our admins, or write it out to file, or
database it. I think your right, produce the trace message then send it.
What would be the best way to accomplish this?
 
Just call your hanlder from the Application_Error event (available in
global.asax).

IMO there is no need to remote this. Just have the local handler create a
message and send it to the support team....

Patrice


--
 
Thank you very much for the help!

Patrice said:
Just call your hanlder from the Application_Error event (available in
global.asax).

IMO there is no need to remote this. Just have the local handler create a
message and send it to the support team....

Patrice
 
Back
Top