I have an ISAPI filter for IIS 6, which does some custom processing using feedback bytes sent field . I want to update it for IIS 7, but I am running into a problem that does not have access to content length, bytes or any data in any of the events IIS 7, which is the length of the content I sent or To calculate bytes (I know that content-length headers and sent bytes are not the same, but either will work for this purpose.)
I can tell that, E header is added after HTTP.SYS have finished executing managed module. Right now I have an event handler that runs on Android. If I can access the output stream then I may need to calculate what I need, but the managed pipeline does not have access to it.
Is there a way to get the content length or bytes in the managed pipeline? If this is not the case, is there any way that I can calculate the length or bytes of material sent from the available items in the managed pipeline? You can use the
property to get the
bytes. As MSDN Docs says that this property sets or sets a wrapping filter object used to modify the body of the HTP unit before transplantation. You can create a new
for the current HTPRPS.filters
to hide the stream and bytes given in Write
The method is calculated before passing them. For example:
Public class content lamentation module: IHttpModule {public zero input (HTTPPCTC reference) {context.BeginRequest + = OnBeginRequest; Context.EndRequest + = OnEndRequest; } Zero OnBeginRequest (Object Sender, EventArgs E) {var Application = (HttpApplication) Sender; Application.Response.Filter = New ContentLengthFilter (application.Response.Filter); } Zero OnEndRequest (Object Sender, EventArgs E) {var Application = (HttpApplication) Sender; Var contentLengthFilter = (ContentLengthFilter) application.Response.Filter; Var contentLength = contentLengthFilter.BytesWritten; } Public Zero Extract () {}} Public Category ContentLengthFilter: Stream {Private Redoni Stream _ Prosfusfilter; Public int written bytes (get; set;) public content filter filter (stream response filter) {_responseFilter = responseFilter;} public override zero flush () {_responseFilter.Flush ();} Public override long-time (long offset, SecOgreen Basic) {Return _ Counter Filter Filters (Offset, Origin);} Public Override Zero SetLength (Long Value) {_responseFilter.SetLength (Value);} Read public override en (Byte [] Buffer, Eastern Dosage offset, integer number) {return_responseFilter.Read (buffer, offset, count);} Override public overwrite (byte [] buffer, integer offset, integer number) {bytes written + = count; _responseFilter.Write (buffer, offset , Counting);} Public Override Bull CanRead {get {reprintfilter.CanRead;}} Public Override Bull CanSeek {Receive {return_responseFilter.CanSeek;}} Public override Bull Canvrite {Return {return_responsefilter.CanWrite;}} Public override Long length T {Return _responseFilter.Length;}} public override find long position {{Return _responseFilter.Position; } Set {_responseFilter.Position = value; }}}
Comments
Post a Comment