Reputation: 593
I wrote a simple HttpListener application, which serves an offline html application. Everything is working fine in firefox, but IE does not apply the style from the css files. It requests them and I send them back, but it does not apply them...
// Construct a response.
List<byte> bytes = new List<byte>();
using (FileStream fs = new FileStream(path, FileMode.Open))
using (BinaryReader br = new BinaryReader(fs))
while (br.BaseStream.Position != br.BaseStream.Length)
bytes.Add(br.ReadByte());
buffer = bytes.ToArray();
// Get a response stream and write the response to it.
response.ContentLength64 = buffer.Length;
response.RedirectLocation = path;
switch (ext)
{
case "css":
mime = "text/css";
break;
case "js":
mime = "text/javascript";
break;
case "png":
mime = "image/png";
break;
case "jpg":
mime = "text/jpeg";
break;
case "gif":
mime = "image/gif";
break;
}
response.AddHeader("content", mime);
using (Stream output = response.OutputStream)
output.Write(buffer, 0, buffer.Length);
break;
Upvotes: 0
Views: 455