如何在asp.net中创建寄存器前缀Uri?

时间:2018-05-17 09:56:42

标签: c# asp.net

static public byte[] GetUrl(string url)
   {  byte[] buf;
        try
        {
             WebProxy myProxy = new WebProxy();
           IWebRequestCreate req = (IWebRequestCreate)WebRequest.Create(url);
           //WebRequest reqw = WebRequest.Create(req);
            WebResponse response = req.GetResponse();
            stream = response.GetResponseStream();

            using (BinaryReader br = new BinaryReader(stream))
            {

                int len = (int)(response.ContentLength);

                buf = br.ReadBytes(len);

                br.Close();
            }

            stream.Close();

            response.Close();
        }
        catch (Exception exp)
        {

            buf = null;
        }

        return (buf);   }

此处url ="数据:image / png; base64,iVBORw0KGgoAAAANSUhEUgAAAOYAAAC + CAIAAACu1eR2A"像那样。如何传递url IWebRequestCreate并获得响应?请让你知道。它对我的项目非常有用。

这里的网址是

  

数据:图像/ PNG; BASE64,iVBORw0KGgoAAAANSUhEUgAAAOYAAAC + CAIAAACu1eR2A"

不被接受。因此,如果我要将数据替换为http或https,则会引发错误,无法识别网址。怎么办?

0 个答案:

没有答案