首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > asp.net >

aspx的WEB代理图片显示有关问题

2013-03-19 
aspx的WEB代理图片显示问题求指导~~~代理web图片显示proxy[解决办法]switch (type){case icon:if (!type

aspx的WEB代理图片显示问题

求指导~~~ 代理 web 图片显示 proxy
[解决办法]
            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 是重点

热点排行