zoukankan      html  css  js  c++  java
  • xml保存图片和读取图片(三)

    5.ImageDisplay.aspx
    <%@ Page language="c#" Codebehind="ImageDisplay.aspx.cs" AutoEventWireup="false" Inherits="WebForm_Question2.ImageDisplay" %>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
    <HTML>
        
    <HEAD>
            
    <title>ImageDisplay</title>
            
    <meta name="GENERATOR" Content="Microsoft Visual Studio .NET 7.1">
            
    <meta name="CODE_LANGUAGE" Content="C#">
            
    <meta name="vs_defaultClientScript" content="JavaScript">
            
    <meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5">
        
    </HEAD>
        
    <body MS_POSITIONING="GridLayout">
            
    <form id="Form1" method="post" runat="server">
                
    <FONT face="宋体"></FONT>
            
    </form>
        
    </body>
    </HTML>

    6.ImageDisplay.aspx.cs
    using System;
    using System.Collections;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Web;
    using System.Web.SessionState;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    using System.Web.UI.HtmlControls;
    using System.Xml;
    using System.Xml.XPath;
    using System.IO;

    namespace WebForm_Question2
    {
        
    /// <summary>
        
    /// ImageDisplay 的摘要说明。
        
    /// </summary>

        public class ImageDisplay : System.Web.UI.Page
        
    {
            
    private void Page_Load(object sender, System.EventArgs e)
            
    {
                
    // 在此处放置用户代码以初始化页面
              
                    
    string imageID=Request.QueryString["imageID"].ToString();
                    
    string fileName = Server.MapPath(".\\ImageList.xml");           
                    XmlDocument doc 
    = new XmlDocument();
                    doc.Load(fileName);
                    XmlNodeList nodelist 
    = doc.SelectSingleNode("//image[imageID='"+imageID+"']").ChildNodes;
                    
    if(nodelist!=null)
                    
    {
                        
    string imageData =nodelist.Item(4).InnerText;
                        
    int imageSize = int.Parse(nodelist.Item(3).InnerText);
                        Response.OutputStream.Write(Convert.FromBase64String(imageData),
    0,imageSize); 
                        Response.End();
                    }

                    
            
            }


            
    Web 窗体设计器生成的代码
        }

    }

    作者:青羽
  • 相关阅读:
    mysql下this is incompatible with sql_mode=only_full_group_by解决方案
    docker 摆渡镜像脚本
    You must reset your password using ALTER USER statement before executing this statement
    docker 镜像自动升级脚本
    Docker容器的重启策略及docker run的--restart选项详解
    xj监控端口,模拟登陆脚本
    docker registry 镜像删除
    CentOS7下Supervisor安装与配置
    修改Docker默认镜像和容器的存储位置
    Kubernetes创建挂载共享存储的容器
  • 原文地址:https://www.cnblogs.com/tenghoo/p/507043.html
Copyright © 2011-2022 走看看