xsharp.eu • IIS7 and up Handler
Page 1 of 1

IIS7 and up Handler

Posted: Tue Oct 24, 2017 3:52 pm
by Horst
Hallo

You all know i am still trying to write a web applikation with XSharp.

First: i tried it with CGI like before with VO. MS IIS7 and up is using something like a sandbox and so some importend DLL for the DBF's and so on is not found. There is a workaorund. You have to start a *.cmd file first and this will call the the CGI , then it works.

Now, before i have to make a decision what i will do. i am trying a second way.

Second: Using a ISS7 Handler. After houres i found a example and i was be able to let it run. Now i have to translate it to XSharp and then i wanna write out a DBF file with index, testing if this solution is be able to use the DBF driver.

using System;
using System.Collections.Generic;
using System.Text;
using System.Web;
using System.IO;

namespace MyIIS7Project
{
public class MyHandler : IHttpHandler
{
#region IHttpHandler Members
public bool IsReusable
{
get { return true; }
}
public void ProcessRequest(HttpContext context)
{
context.Response.Write(
String.Format("<h1>{0}</h1>",
Directory.GetCurrentDirectory()
));
}
#endregion
}
}
BTW the current durectory is windowssystem32intserv

My Version is:
BEGIN NAMESPACE MyIIS7Project
public class MyHandler inherit IHttpHandler
#region IHttpHandler Members
Method IsReusable () as logic
return true

Method ProcessRequest(context as HttpContext) as void
context:Response:Write("Hallo Welt")
return

end class
#endregion
END NAMESPACE

But i got this error
Fehler XS0535 'MyHandler' does not implement interface member 'IHttpHandler.IsReusable' MyIIS7Project C:UsersBesitzersourcereposMyIIS7ProjectMyIIS7ProjectMyHandler.prg 8
its on the line public class ....

Help :-)

Horst

IIS7 and up Handler

Posted: Tue Oct 24, 2017 4:02 pm
by Chris
Hi Horst,

"IsReusable" is a property, not a method, so you'd need to define int like that:

ACCESS IsReusable AS LOGIC
RETURN TRUE

or, in the more /Net style (completely equivalent) syntax:

PROPERTY IsReusable AS LOGIC
GET
RETURN TRUE
END GET
END PROPERTY

or, like the simplified onliner:

PROPERTY IsReusable AS LOGIC GET TRUE

all the above should do the trick.

Chris

IIS7 and up Handler

Posted: Tue Oct 24, 2017 5:58 pm
by wriedmann
Hi Horst,

Code: Select all

public class MyHandler : IHttpHandler
could be translated to

Code: Select all

public class MyHandler inherit IHttpHandler
and to

Code: Select all

public class MyHandler implements IHttpHandler
But since IHttpHandler is an interface,

Code: Select all

implements
is the correct one.

Wolfgang