コード例 #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Response.Clear();
            MyImageService.ServiceClient fromService = new MyImageService.ServiceClient();
            string myStr, userLen;

            if (Session["generatedString"] == null)
            {
                if (Session["userLength"] == null)
                {
                    userLen = "4";
                }
                else
                {
                    userLen = Session["userLength"].ToString();
                }
                myStr = fromService.GetVerifierString(userLen);
                Session["generatedString"] = myStr;
            }
            else
            {
                myStr = Session["generatedString"].ToString();
            }
            Stream myStream = fromService.GetImage(myStr);

            System.Drawing.Image myImage = System.Drawing.Image.FromStream(myStream);
            Response.ContentType = "image/jpeg";
            myImage.Save(Response.OutputStream, ImageFormat.Jpeg);
        }
コード例 #2
0
        protected void NewImageButton_Click(object sender, EventArgs e)
        {
            MyImageService.ServiceClient fromService = new MyImageService.ServiceClient(); // create proxy to the remote service
            string length = "4";

            Session["userLength"] = length;
            string myStr = fromService.GetVerifierString(length);

            Session["generatedString"] = myStr;
            Image1.Visible             = true;
        }