DGL
https://delphigl.com/forum/

delphi 2005 .net question
https://delphigl.com/forum/viewtopic.php?f=19&t=3509
Seite 1 von 1

Autor:  noeska [ Di Nov 23, 2004 15:39 ]
Betreff des Beitrags:  delphi 2005 .net question

I am currently trying to get ihttphandler getting to work within delphi. But all i get is that ihttphandler is not defined. I know it is as it lives inside system.web as i am able to use it from vb.

e.g. in vb i use

imports System.Web

public class MyHttpHandler
implements ihttphandler

Now for delphi 2005 .net i think i have to do something like:

uses System.Web

type
TMyHttpHandler = class(TInterfacedObject, IHttpHandler)

but all i get is that IHttpHandler is not defined. What am i doing wrong?
Or is it the fact that i try to do this from a library? It should be as i also do this with vb.net a ihttphander lives inside an dll file.

Autor:  LarsMiddendorf [ Di Nov 23, 2004 18:23 ]
Betreff des Beitrags: 

Is system.web.dll in the project references list ?

Autor:  noeska [ Di Nov 23, 2004 19:27 ]
Betreff des Beitrags: 

ah, that did the trick. I just feel stupid as i also do a thing like that with vb.net :oops:

Autor:  noeska [ Di Nov 23, 2004 20:25 ]
Betreff des Beitrags: 

now on to the next problem, this time i do not even get an compiler error, but an access violation error.....

this is the code
type
tmyhandler = class(TInterfacedObject, IHttpHandler, IRequiresSessionState)
procedure IHttpHandler.ProcessRequest = myProcessRequest;
procedure myProcessRequest(ByVal: System.Web.HttpContext): System.Web.IHttpHandler.ProcessRequest
end;

begin
procedure tcontext.myprocessrequest(ByVal: System.Web.HttpContext): System.Web.IHttpHandler.ProcessRequest
begin
response.write('Hello world!');
end;

Now i must be doing something wrong again....

Autor:  noeska [ Di Nov 23, 2004 23:52 ]
Betreff des Beitrags: 

fixed that also:

Code:
  1.  
  2. type
  3.  tmyhandler = class(TInterfacedObject, IHttpHandler, IRequiresSessionState)
  4.    procedure ProcessRequest(context: HttpContext);
  5.    function get_IsReusable: boolean;
  6.    property IsReusable: boolean read get_IsReusable;
  7.   end;
  8.  
  9.   procedure tmyhandler.ProcessRequest(context: HttpContext);
  10.   begin
  11.     //response.write('Hello world!');
  12.   end;
  13.  
  14.   function tmyhandler.get_IsReusable: boolean;
  15.   begin
  16.     result:=false;
  17.   end;
  18.  

Autor:  noeska [ Mi Nov 24, 2004 11:17 ]
Betreff des Beitrags: 

now it compiles ok, but iis does not find it an valid httphandler class.
tmyhandler cannot be found inside the dhandlertest.dll assembly...
i am starting to dislike delphi2005 for this...
any ideas on what i am doing wrong...

also as a side note the vb version of my httphandler is only 36kb large and this incomplete non working implementation is 99kb large, using classes with it makes it 1mb large....

Autor:  noeska [ Fr Nov 26, 2004 11:24 ]
Betreff des Beitrags: 

i found out why it does not work. I seems that delphi.net is not cls complaint. Read the folowing thread if you want to know more about it: http://newsgroups.borland.com/cgi-bin/d ... ated+Items

Seite 1 von 1 Alle Zeiten sind UTC + 1 Stunde
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/