VB AND C++ ISAPI Redirection Extension 
Author Message
 VB AND C++ ISAPI Redirection Extension

The reason Im trying to do this is to avoid HTTP302 message being sent to
the client if you have any ideas how to do this in vb please let me know.

Anyhow, I have created a vb com component and references and C++ ISAPI
Extension
can be downloaded from here:

http://www.*-*-*.com/

In my vb code I have in a module

Declare Function HttpExtensionProc Lib "C:\inetpub\scripts\redirect.dll"
(sQueryString)

In my class I have
I think I have to do this in order for C++ to understand its a string ???

Public Function SendTo()
    Dim sInput As String
    Dim Blah() As Byte
    Dim nTemp As Integer
    Dim nLoop As Integer

    sInput = "/mynan.asp?sid=23874982"
    nTemp = Len(sInput) + 1

    ReDim Blah(nTemp)

    For nLoop = 0 To nTemp

    If (nTemp - 1) > nLoop Then
        Blah(nLoop) = Asc(Mid(sInput, (nLoop + 1), 1))
    Else
        Blah(nLoop) = 0
    End If

    Next nLoop

    HttpExtensionProc (Blah)

End Function

I have changed the C++ source code and complied it

DWORD WINAPI
HttpExtensionProc(
    IN EXTENSION_CONTROL_BLOCK * pECB,
 char *sString
)
/*++

Purpose:

    If no query string is present, or if the query
    string is not identified as a legal target for redirection,
    Redirect.dll will return a page to the client with brief
    instructions for its use.

    Redirections to a resource on the same server as the dll will
    be handled by IIS and will be transparent to the browser
    (HSE_REQ_SEND_URL).

    Redirections to a resource on a different server will result
    in an HTTP 302 response instructing the browser to obtain the
    resource from another location (HSE_REQ_SEND_URL_REDIRECT_RESP).

Arguments:

    pECB - pointer to the extenstion control block

Returns:

    HSE_STATUS_SUCCESS on successful completion
    HSE_STATUS_ERROR on failure

--*/
{
    //
 // If no query string is present, return the instruction page
    //

 //   if ( !strlen( pECB->lpszQueryString ) ) {

//  return SendInstructionPage( pECB );
//    }

    //
 // Check to see if the redirect URL is on another server. If it is, use
 // HSE_REQ_SEND_URL_REDIRECT_RESP.  If it's on this local server, use
 // HSE_REQ_SEND_URL to return the specified URL without using an HTTP 302
 // status code.
    //

 DWORD dwBuffSize = strlen( pECB->lpszQueryString );

//    if ( !strnicmp( pECB->lpszQueryString, "http://", 7 ) ) {

//        pECB->ServerSupportFunction(
//            pECB->ConnID,
//            HSE_REQ_SEND_URL_REDIRECT_RESP,
//            pECB->lpszQueryString,
//            &dwBuffSize,
//           NULL
//            );

//    } else {

        //
  // Check to make sure that query string begins with a '/'.
        //

//        if ( *( pECB->lpszQueryString ) != '/' ) {

//   return SendInstructionPage( pECB );
//        }

  pECB->ServerSupportFunction(
            pECB->ConnID,
            HSE_REQ_SEND_URL,
            sString,
            &dwBuffSize,
            NULL
            );
// }

 return HSE_STATUS_SUCCESS;

Everytime I get the server threw an exception???
Does anyone know what Im doing wrong? Im not a C++ programmer so Im a little
lost when it comes to the ISAPI extension

Anyhow, many thanks
Ash



Mon, 25 Aug 2003 20:08:22 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. REDIRECTION USING ISAPI EXTENSION THROWS SERVER ERROR

2. Creating ISAPI Extensions with VB

3. ISAPI extensions in VB?

4. Doing ISAPI Filters & Extensions in VB

5. programming ISAPI extension in VB

6. ISAPI extension dll's in VB 5.0?

7. Returning strings from VB COM components to C++ Isapi DLL

8. writing ISAPI extensions in .NET: any support?

9. Is it possible to build an ISAPI extension with VB6

10. ISAPI server extensions

11. ISAPI extension that returns a GIF

12. Using the C++ Prelim RAS API Extensions in Visual basic

 

 
Powered by phpBB® Forum Software