<%@ Page Language="C#" AutoEventWireup="true"  CodeFile="Default.aspx.cs" Inherits="_Default" %>
<%@ Import Namespace ="System.IO" %>
<script runat = "server">

    protected void Page_Load(object sender, EventArgs e)
    {
        //指定被输出图像的地址
        string strPath = Request.MapPath("~/Images/ajax.gif");
       
        //创建文件流,读取将要输出的图像
        FileStream fs = new FileStream(strPath, FileMode.Open, FileAccess.Read);
       
        //定义保存图像数据的二进制数组
        byte[] imageData = new byte[(int)fs.Length];
   
        //读取二进制数组
        fs.Read(imageData, 0, (int)fs.Length);
   
        //输出二进制数组(图像)
        Response.BinaryWrite(imageData);

        //设置页面的输出格式. 具体格式见 Web文件的ContentType类型大全
        Response.ContentType = "image/gif";

        //中止页面的其他输出
        Response.End();
    }   
   
</script>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>图像输出</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
   
    </div>
    </form>
</body>
</html>

 

运行结果:

 

 

Logo

GitCode 天启AI是一款由 GitCode 团队打造的智能助手,基于先进的LLM(大语言模型)与多智能体 Agent 技术构建,致力于为用户提供高效、智能、多模态的创作与开发支持。它不仅支持自然语言对话,还具备处理文件、生成 PPT、撰写分析报告、开发 Web 应用等多项能力,真正做到“一句话,让 Al帮你完成复杂任务”。

更多推荐