?
Solved

Returning http error codes with MFC isapi extension

Posted on 2003-02-20
3
Medium Priority
?
297 Views
Last Modified: 2013-11-20
I'm writing an MFC isapi extension, running in IIS 5.0, Windows 2000.
How can I return HTTP error code (such as 404, 500 etc) in the HTTP header to the HTTP client.

Thanks,
Michael.
0
Comment
Question by:bachar
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 12

Accepted Solution

by:
migel earned 1200 total points
ID: 7986621
Hi!
to do that you have to write some extra call in the your
HttpExtensionProc
for example:
DWORD CMyExtension::HttpExtensionProc( EXTENSION_CONTROL_BLOCK *pECB ){

if (....) // some conditions
{
// Raize Access denied error
          pECB->dwHttpStatusCode=HTTP_STATUS_AUTH_REQUIRED;
          strcpy(pECB->lpszLogData,"WWW-Authenticate: Basic Realm=\"Secure\"\r\n\r\n");

          size = lstrlen ( pECB->lpszLogData);
          pECB -> ServerSupportFunction ( pECB->ConnID,
                                        HSE_REQ_SEND_RESPONSE_HEADER,
                                        "401 Access Denied",
                                        &size,
                                        (LPDWORD) pECB->lpszLogData );
         
          return HSE_STATUS_ERROR;
}
}
 
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction: Load and Save to file, Document-View interaction inside the SDI. Continuing from the second article about sudoku.   Open the project in visual studio. From the class view select CSudokuDoc and double click to open the header …
Introduction: Dialogs (1) modal - maintaining the database. Continuing from the ninth article about sudoku.   You might have heard of modal and modeless dialogs.  Here with this Sudoku application will we use one of each type: a modal dialog …
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
Suggested Courses

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question