isapi
TRANSCRIPT
-
8/9/2019 ISAPI
1/13
ISAPI SERVEREXTENSIONS
-
8/9/2019 ISAPI
2/13
A program implemented as a dll and loaded by IIS.
Run in response to a GET or POST request from a client
program ( browser )
Sends back HTML code.
-
8/9/2019 ISAPI
3/13
A part of HTTP and a way for browser programs to interact
with scripts.
Using CGI parameters , browser sends small amounts of data
to server.
Server can access databases , generate images and control
peripheral devices.
Server sends back HTML code to browser.
CGI and ISAPI
-
8/9/2019 ISAPI
4/13
Consider the following HTML code ;
Chennai map
When user clicks on Chennai map , browser sends
the following CGI GET request to the server ;
GET scripts/maps.dll ? City = chennai HTTP/1.0
IIS then loads maps.dll from the scripts directory and calls a default
function ( Default ) , and passes a parameter chennai.The dll generates a jpg file containing the latest
satellite image of Chennai and sends it to the client.
A SIMPLE ISAPI SERVER EXTENSION GET
REQUEST
-
8/9/2019 ISAPI
5/13
If maps.dll has more than one function ;
Chennai map
In this case , GetMap() called with two parameters
(i) City
(ii) Res
-
8/9/2019 ISAPI
6/13
HTML forms GET vs POST
City map
Welcome to Satellite map service
Select your city :
Delhi
Chennai
Mumbai
-
8/9/2019 ISAPI
7/13
OUTPUT
The CGI request looks something like this ;
GET scripts/maps.dll ? GetMap ? City = chennai HTTP / 1.0
-
8/9/2019 ISAPI
8/13
Using POST method
HTML code ;
-
8/9/2019 ISAPI
9/13
WRITING AN ISAPI SERVER EXTENSION DLL
VC++ File New ISAPI ExtensionWizard Give a name (isapi) Ok
-
8/9/2019 ISAPI
10/13
A class is derived from the MFC CHttpServer class and a Default member
function is included.
Insert the below lines into isapi.cpp ;
BEGIN_PARSE_MAPON_PARSE_COMMAND ( GetMap , CWeatherExtension , ITS_PSTR)
ON_PARSE_COMMAND_PARAMS ( city )
END_PARSE_MAP
void CIsapiExtension::GetMap(CHttpServerContext* pCtxt,LPCTSTR pstrCity)
{StartContent(pCtxt);
WriteTitle(pCtxt);
*pCtxt
-
8/9/2019 ISAPI
11/13
View ClassWizard Message maps Add function GetTitle()
LPCTSTR CIsapiExtension :: GetTitle () const
{
return Your custom map ;
}
In isapi.h ;
Void GetMap ( CHttpServerContext * pCtxt , LPCTSTR pstrCity ) ;
The CHttpServerContext class has an overloaded
-
8/9/2019 ISAPI
12/13
THE MFC ISAPI SERVER EXTENSION CLASSES
CHttpServer
CHttpServerContext
CHtmlStream
-
8/9/2019 ISAPI
13/13
THANK YOU