Upload result web page

delphi package - automated exception handling
Post Reply
hlogmans
Posts: 6
Joined: Thu Dec 01, 2005 3:16 pm
Location: Leusden
Contact:

Upload result web page

Post by hlogmans »

Hi,

in V2 i made an http-upload procedure that displayed the resulting web page when posting a bug report. My question was how to do this in V3.

After inspecting the code i noticed redirection is supported for the result, so if i want to display some additional info, i need to set the location-header in PHP:

Code: Select all

<?php
header("Location: http://www.kluwersupport.net/someinfo.php?id=GetUpdateNow");
?>
Took some time, because i could not find it in docs or sources...

Kind regards,

Hugo
madshi
Site Admin
Posts: 10766
Joined: Sun Mar 21, 2004 5:25 pm

Post by madshi »

But you got it working fine?
hlogmans
Posts: 6
Joined: Thu Dec 01, 2005 3:16 pm
Location: Leusden
Contact:

Post by hlogmans »

Yup, works nice.
I'm only thinking about how to implement this feature in real-life. In the redirected page I can only use GET-parameters so i need to store all relevant information in the database and on the result page i need to extract this info. Or store it in session cookies etc, but i'm not that experienced in php and asp...

Most of the time the redirect would be extracting the solution from the database (only record ID needed in GET) if available, so that won't be much of a problem.
hlogmans
Posts: 6
Joined: Thu Dec 01, 2005 3:16 pm
Location: Leusden
Contact:

Post by hlogmans »

I have trouble getting the assistant vars to upload. I want to set the user name and email as POST-vars. But i don't know how to intercept the fields between the assistant and the actual sending. Registering an action-handler did not work because it is called BEFORE the assistants are executed.

I add all intended fields (like crc1 & 2) as POST -vars by adding to the mesettings.additionalfields. Works OK but now i want the three fields from the assistant. I don't want to extract them from the bug-report because that's quite complicated.

Maybe an assistant option should be to add all fields to the additionalfields values (or option of edit field).

Any help?
hlogmans
Posts: 6
Joined: Thu Dec 01, 2005 3:16 pm
Location: Leusden
Contact:

Post by hlogmans »

Solved it: a MailFrom is always set in the POST fields. Because i POSTed the bugreport also and the red function only reads 5120 bytes this was discarded . I think i should read the contents from the report from the file but this was easier.

I added the line
exc.AdditionalFields.Add(nve.OutputName, nve.Text);
to the PutAssisIntoBugreport to post all edit fields. Worked but not neccesary anymore.
madshi
Site Admin
Posts: 10766
Joined: Sun Mar 21, 2004 5:25 pm

Post by madshi »

You can add additional fields without having to change madExcept.pas. Just use RegisterExceptionHandler or RegisterExceptActionHandler and write to "exceptIntf.AdditionalFields".
hlogmans
Posts: 6
Joined: Thu Dec 01, 2005 3:16 pm
Location: Leusden
Contact:

Post by hlogmans »

No, this is not sufficient, because there seems to be no handler being fired AFTER the assistants have been executed (and form field are filled). And my goal was to save the field data to POST fields (instead of being added to the bugreport).
hlogmans
Posts: 6
Joined: Thu Dec 01, 2005 3:16 pm
Location: Leusden
Contact:

Post by hlogmans »

Created a separate unit i only have to include in my project, that serves all my needs. I think i will all settings to it (like server address etc, i now made them default).

Code: Select all

unit CrashSettings;

interface

implementation
uses MadExcept, SysUtils, MadTools;

procedure MadExceptionHandler1Exception(
  const exceptIntf: IMEException; var handled: Boolean);
var s: string;
    x : integer;
begin
  MESettings.AdditionalFields.Add('crc1', inttostr(exceptIntf.CallstackCrc[0]));
  MESettings.AdditionalFields.Add('crc2', inttostr(exceptIntf.CallstackCrc[1]));
  MESettings.AdditionalFields.Add('progcode', Uppercase(ExtractFileName(paramstr(0))));
  MESettings.AdditionalFields.Add('eclass', exceptIntf.ExceptClass);
  MESettings.AdditionalFields.Add('emsg', exceptIntf.ExceptMessage);
  MESettings.AdditionalFields.Add('report', exceptIntf.BugReport);
  MESettings.AdditionalFields.Add('version', FileVersionToStr(GetFileVersion(ParamStr(0))));
end;


initialization

  RegisterExceptionHandler(MadExceptionHandler1Exception, stDontSync, epCompleteReport);

finalization
  UnRegisterExceptionHandler(MadExceptionHandler1Exception);

end.
[/code]
Post Reply