I am dealing with some code that uses a custom HttpResponse filter in an asp.net application.
response.Filter = new HtmlResponseFilterStream();
This HtmlResponseFilterStream inherits from MemoryStream . The write method has been overriden to get the contents of the HTTP response. I use Encoding.UTF8.GetString to get the contents of the page in chunks.
public override void Write(byte[] buffer, int offset, int count)
{
var contentInBuffer = Encoding.UTF8.GetString(buffer);
...
}
In my local machine if I go to any page and debug the code I can see the the variable contentInBuffer populated with the actual html contents. Both with local ISS or iss express. This also works in our production environment.
However, if I go to a test machine things don't work as expected. If I debug the contents inside the write method (using remote debugger). I get some weird characters instead. So I guess this is due to some different encoding used.. maybe..
Both production and test servers have same specs with same OS and iis server versions.
I checked .Net Globalization settings and the encodings are set to UTF-8 for Request, Response Headers and Response in both machines.
I am pretty sure this has to be something related to the environment settings. Not sure if it's related with IIS or windows.
Any idea anyone?
怪异的字符必须归因于GZip压缩,它被称为“动态压缩”,通常默认情况下不安装,但看起来您的测试计算机已经安装了它。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.