Skip to content

Instantly share code, notes, and snippets.

@karlbohlmark
Created September 20, 2013 14:24
Show Gist options
  • Save karlbohlmark/6638374 to your computer and use it in GitHub Desktop.
Save karlbohlmark/6638374 to your computer and use it in GitHub Desktop.
IIS module set request header
GLOBAL_NOTIFICATION_STATUS
OnGlobalPreBeginRequest(
IN IPreBeginRequestProvider * pProvider
)
{
IHttpContext* pHttpContext = pProvider->GetHttpContext();
IHttpRequest* pRequest = pHttpContext->GetRequest();
char *szRange = "bytes=300-1000";
HRESULT result = pRequest->SetHeader((PCSTR)"Range", (PCSTR) szRange, (USHORT) strlen(szRange), true /* replace header */);
if (FAILED(result)) {
WriteEventViewerLog( "Failed" );
}
WriteEventViewerLog( "Add range header" );
return GL_NOTIFICATION_CONTINUE;
}
@HelTaNiM
Copy link

HelTaNiM commented Feb 9, 2015

Hi,

I rely on the same code in the same function. but SetHeader is not apply by IIS 7.5: Range byte is well defined in OnGlobalTraceEvent function into RawHttpRequest !

do you have same issue ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment