thanks,
Behzad
ISAPI DLLs extend Microsoft's web server, IIS. Web servers don't deal in
desktops. They deal in pages which they return to clients. Those clients may
be running on Windows desktops or Apples' or KDE's etc.
Can't the desktops that you care about send a GET or POST referencing the
ISAPI extension in the URL.
Regards,
Will
thanks ,
Behzad
_____________________________________________________________
"behzad" <behz...@yahoo.com> wrote in message
news:uYxrMa8...@tk2msftngp13.phx.gbl...
Ah, I see. When I read your question the first time I thought you wanted to
have the web server communicate with the desktop running the browser. In the
general case, where server and browser are at arbitrary locations on the
network, that would have been problematic.
So then, your application is a server that can field requests from client
browsers? If so, an option is to build a scaled-down version of a web
server. You might want to start with this sample which uses MFC to build a
server which binds a socket to a port (most often 80) waiting for an HTTP
request.
If that PC already runs a web server, another option is to use ISAPI, ASP or
CGI etc either to implement the application, or to implement a bridge to, or
an adaptor for, your application. That is, the user might browse to
http://YourServer/YourISAPIDll.dll?request=doSomething
The ISAPI DLL (or ASP page or CGI app) looks at the URL to determine the
request type and then makes the corresponding request via RPC to your
application. The application returns its result to your web application in
the usual way. Then the web application builds an HTML formatted "page"
containing the response which the browser displays to the user.
I don't know if you have jumped on the .Net bandwagon yet, but one of the
reasons it exists is to put in place the infrastructure that allows
applications to be viewed as "Web services" to be "consumed" by remote
clients possibly running browsers.
Regards,
Will
thanks
behzad
"William DePalo [MVP VC++ ]" <willd....@mvps.org> wrote in message
news:#7hJpNFb...@TK2MSFTNGP10.phx.gbl...
You are welcome.
> how a cgi or isapi dll can communicate with an application which is
> previously running, I mean both the application and the web server are on
> the same machine.
At the risk of staring the obvious, the application has to expose some
interface to outsiders. :-) You can use sockets, named pipes, remote
procedure calls, mail slots, COM, shared memory, shared files, ... etc
> I tryed to use a pipe on isapi dll , but it could connect to other
> applications running on server. I tryed to send messages, too.
> I think there is something That I do not know!
A pipe is a securable object on NT. By _default_ objects are accessible to
threads which run in the same user context as the thread which created the
object. Depending on the security model you choose for the extension it may
run as LocalSystem or IUSR_machineName. If your application rns under a
different account, that may be way you have trouble. But you shouldn't have
to guess. Virtuallu all of theWin32 functions that can fail do so by setting
the last error for the thread which you can retrieve with GetLastError().
The possible return values are enumerated in <winerror.h>
If access control is the problem, you can put a security descriptor on the
pipe that allows any thread running as an authenticated user to gain access
with these few lines:
// Warning, this was cut and pasted, so it may not compile
BYTE SD[SECURITY_DESCRIPTOR_MIN_LENGTH];
SECURITY_ATTRIBUTES sa;
sa.nLength = sizeof(sa);
sa.bInheritHandle = TRUE;
sa.lpSecurityDescriptor = &sd;
InitializeSecurityDescriptor( (PSECURITY_DESCRIPTOR) &sd,
SECURITY_DESCRIPTOR_REVISION);
SetSecurityDescriptorDacl( (PSECURITY_DESCRIPTOR) &sd, TRUE, (PACL) NULL,
FALSE);
hPipe = CreateNamedPipe("name",
PIPE_ACCESS_DUPLEX,
PIPE_TYPE_MESSAGE | PIPE_READMODE_MESSAGE | PIPE_WAIT,
PIPE_UNLIMITED_INSTANCES,
YourOutputSize, YourInputSize,
YourTimeoutPeriod, &sa);
> U wrote about RPC, if it is the answer , do u know any tutorials about it
?
The nice thing about RPC, is that client and server communicate via simple
function call once you have the defined the interface and have created the
proxies and stubs. It does take a little while to get up to speed, though.
You should find a link to a tutorial on this page:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/rpc/rpc/overviews.asp
Regards,
Will
again thanks,
Behzad
"William DePalo [MVP VC++ ]" <willd....@mvps.org> wrote in message
news:O#9AwYNbD...@TK2MSFTNGP12.phx.gbl...
You are welcome.
> Finally I could have all componenets working. It was possibly security
> problem.
Where services are concerened, it usually is.
> That piece of code did not work,
I'm sorry it didn't work in your situtation. I cut and pasted the code into
the post from a _running_ ISAPI application of mine that uses an extension
to receive requests ultimately bound for a NT service with a named pipe
interface.
> but I changed the anonymous user
> account which IIS uses to an admin account , and it worked ok!
I'm glad you resolved the problem.
> Maybe it is not ok for an isapi dll communuicae with
> an application in a usual manner in Microsoft point of view.
That's not correct. An ISAPI extension is just a DLL that is hosted by a
particular NT service. The usual rules apply.
Regards,
Will
again thanks for your hint,
Behzad
"William DePalo [MVP VC++ ]" <willd....@mvps.org> wrote in message
news:OENn$UwbDH...@TK2MSFTNGP11.phx.gbl...