Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/asp.net/30.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 为什么在IE中,上传的PNG图像被识别为PJPEG内容类型(asp.net mvc 3)?_C#_Asp.net_Asp.net Mvc 3 - Fatal编程技术网

C# 为什么在IE中,上传的PNG图像被识别为PJPEG内容类型(asp.net mvc 3)?

C# 为什么在IE中,上传的PNG图像被识别为PJPEG内容类型(asp.net mvc 3)?,c#,asp.net,asp.net-mvc-3,C#,Asp.net,Asp.net Mvc 3,我现在遇到了IE9中的奇怪行为 我有一行用C#编写的用于asp.net(带mvc 3)应用程序的简单代码: string ct = image.ContentType; // image is `HttpPostedFileBase` type 当我在IE9中调试时,ct在我选择png文件时返回image/pjpeg。我没有将该文件从1.jpg/1.jpeg重命名为1.png 如果我使用Firefox/Chrome作为浏览器进行调试,那么ct=“image/png”(这是正确的)

我现在遇到了IE9中的奇怪行为

我有一行用C#编写的用于asp.net(带mvc 3)应用程序的简单代码:

   string ct = image.ContentType;
   // image is `HttpPostedFileBase` type
当我在IE9中调试时,
ct
在我选择png文件时返回
image/pjpeg
。我没有将该文件从
1.jpg
/
1.jpeg
重命名为
1.png

如果我使用Firefox/Chrome作为浏览器进行调试,那么
ct=“image/png”
(这是正确的)

为什么PNG文件被视为
图像/pjpeg
内容类型

如何解决这个问题


或者它是IE中的一个bug?

文件本身真的是png吗?或者是文件扩展名不正确的jpg?这可能是与内容嗅探相关的问题。我提到我没有将
jpg
重命名为
png
。我使用了Photoshop,我保存为PNG而不是JPG/JPEG。