How to judge whether content type is truly "text/html"?
- From: "Morgan Cheng" <morgan.chengmo@xxxxxxxxx>
- Date: 21 Sep 2006 07:05:23 -0700
I know that HttpWebRequest.GetResponse() generates a HttpWebResonse.
The response has one ContentType property. But the property is just
decided by http response header. It is possible that the content is
actually HTML, while the ContentType is "image/jpeg".
Is there any effective way to judge whether the response type is truly
"text"?
I have a idea to read the first several bytes of the response stream;
and check whether they are real displayable characters. But, they can
be any kind of Encoding. Should I try all kinds of Encoding?
.
- Follow-Ups:
- Re: How to judge whether content type is truly "text/html"?
- From: Kevin Spencer
- Re: How to judge whether content type is truly "text/html"?
- Prev by Date: Re: Flash ActiveX : loading from SWF in memory with FWK 2.0
- Next by Date: Re: Yet another app.config question - Isn't this supposed to be easy?
- Previous by thread: error when invoke in thread
- Next by thread: Re: How to judge whether content type is truly "text/html"?
- Index(es):
Relevant Pages
|
Loading