本帖最后由 gujin33 于 2013-03-14 17:08:46 编辑

解决方案 »

  1.   

                switch (type)
                {
                    case "icon":
                        if (!typeValue.EndsWith(".png") && !typeValue.EndsWith(".gif"))
                        {
                            typeValue = IconHelper.GetName((Icon)Enum.Parse(typeof(Icon), typeValue));
                        }
                        //resName += "res.icon." + typeValue;
                        string serverPath = String.Format("{0}/{1}", GlobalConfig.GetIconBasePath(), typeValue);
                        context.Response.WriteFile(context.Server.MapPath(serverPath));                    context.Response.ContentType = "image/" + GetImageFormat(typeValue);
                        break;
                    case "js":
                    case "lang":
                        context.Response.Write(ResourceHelper.GetResourceContent(resName));
                        context.Response.ContentType = "text/javascript";
                        break;
                    case "css":
                        context.Response.Write(ResourceHelper.GetResourceContent(resName));
                        context.Response.ContentType = "text/css";
                        break;
                    case "theme":
                    case "img":
                        binary = ResourceHelper.GetResourceContentAsBinary(resName);
                        context.Response.OutputStream.Write(binary, 0, binary.Length);
                        //context.Response.Write(ResourceHelper.GetResourceContent(resName));
                        context.Response.ContentType = "image/" + GetImageFormat(resName);
                        break;
                }
    context.Response.ContentType 是重点