示例#1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(Url))
            {
                throw new ArgumentNullException("Url is NUll !");
            }

            CreateWebImg cwi = new CreateWebImg(Url, 0);
            MyResetEvent set = new MyResetEvent();

            cwi.Start(set.setEvent);
            set.setEvent.WaitOne();

            MemoryStream stream = cwi.ImageStream;

            if (stream != null)
            {
                using (stream)
                {
                    byte[] buff = stream.ToArray();
                    Response.ContentType = "image/Jpeg";
                    Response.BinaryWrite(buff);
                }
            }
            Response.End();
        }
示例#2
0
文件: WebSnap.cs 项目: nkaluva/helper
        protected void Page_Load(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(Url))
            {
                throw new ArgumentNullException("Url is NUll !");
            }

            CreateWebImg cwi = new CreateWebImg(Url, 0);
            MyResetEvent set = new MyResetEvent();
            cwi.Start(set.setEvent);
            set.setEvent.WaitOne();

            MemoryStream stream = cwi.ImageStream;
            if (stream != null)
            {
                using (stream)
                {
                    byte[] buff = stream.ToArray();
                    Response.ContentType = "image/Jpeg";
                    Response.BinaryWrite(buff);
                }
            }
            Response.End();
        }