zoukankan      html  css  js  c++  java
  • ASP.net流的方式输出图片或文件

    using System;
    using System.Collections;
    using System.Configuration;
    using System.Data;
    using System.Linq;
    using System.Web;
    using System.Web.Security;
    using System.Web.UI;
    using System.Web.UI.HtmlControls;
    using System.Web.UI.WebControls;
    using System.Web.UI.WebControls.WebParts;
    using System.Xml.Linq;
    using System.IO;
    public partial class admin_showimg : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            string img = Request.QueryString["img"];
            string pic;
            if (img == null || img == "")
            {
                pic = Server.MapPath("/images/nopic.jpg");
            }
            else
            {
                pic = Server.MapPath("/") + img;
            }
            if (File.Exists(pic))
            {
                Response.ContentType = "image/jpg";
                Response.WriteFile(pic);
            }
        }
    }
  • 相关阅读:
    hdu 5366 简单递推
    hdu 5365 判断正方形
    hdu 3635 并查集
    hdu 4497 数论
    hdu5419 Victor and Toys
    hdu5426 Rikka with Game
    poj2074 Line of Sight
    hdu5425 Rikka with Tree II
    hdu5424 Rikka with Graph II
    poj1009 Edge Detection
  • 原文地址:https://www.cnblogs.com/easypass/p/1620399.html
Copyright © 2011-2022 走看看