IIS7 and up Handler

This forum is meant for questions and discussions about the X# language and tools
Post Reply
User avatar
Horst
Posts: 327
Joined: Tue Oct 13, 2015 3:27 pm

IIS7 and up Handler

Post 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
User avatar
Chris
Posts: 4562
Joined: Thu Oct 08, 2015 7:48 am
Location: Greece

IIS7 and up Handler

Post 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
Chris Pyrgas

XSharp Development Team test
chris(at)xsharp.eu
User avatar
wriedmann
Posts: 3644
Joined: Mon Nov 02, 2015 5:07 pm
Location: Italy

IIS7 and up Handler

Post 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
Wolfgang Riedmann
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
Post Reply