I try to intercept textraw from my Custom OutputCacheProvider CacheEntry Buffer.
when I use cacheEntry.ResponseElements.First()
I get the Half of my html page, but when I try to concat all chunck, I've get a crapy response (looks like binary serialized data).
How can I do someting like :
IOutputCacheEntry cacheEntry = cachedItem.Item as IOutputCacheEntry;
StringBuilder textResponse = new StringBuilder();
foreach (var responseRaw in cacheEntry.ResponseElements.Where(s=>!(s is FileResponseElement )))
{
Byte[] bytes = (Byte[])responseRaw.GetType().GetField("_buffer",
BindingFlags.NonPublic |
BindingFlags.Instance).GetValue(responseRaw);
textResponse.Append(Encoding.Default.GetString(bytes));
}
edit : I tried to concat all byte[] before "Stringify" them, and I tried with UTF-8 encoding.