HttpWebRequest

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/qq_32961291/article/details/79565802
 public void GetInterface(string path)
        {
            try
            {
                Uri uri = new Uri(path);
                HttpWebRequest req = (HttpWebRequest)WebRequest.Create(uri);
                WebResponse resp = req.GetResponse();
                req.KeepAlive = false;
                if (resp != null)
                {
                    resp.Close();
                }
                if (req != null)
                {
                    req.Abort();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message.ToString());
            }


        }

猜你喜欢

转载自blog.csdn.net/qq_32961291/article/details/79565802