无效的URI错误从网页获取数据并匹配有效期

时间:2018-11-29 01:49:34

标签: c# url httpwebresponse

public string _hostName = "99bd.net";
HttpWebRequest myRequest = (HttpWebRequest)WebRequest.Create(_hostName + "/db/api_update.php?auth_cpu_id=" + GetCPU_Serioal_No());
myRequest.Method = "GET";
WebResponse myResponse = myRequest.GetResponse();
StreamReader sr = new StreamReader(myResponse.GetResponseStream(), System.Text.Encoding.UTF8);
string result = sr.ReadToEnd();

if (result == null)
{
    this.logarea.Text = "License Valid & Connected to www." + _hostName;
}
else
{
    this.logarea.Text = "License InValid Dis-Connected From www." + _hostName;
}

//我的问题(无效的URI:无法确定URI的格式。)

    public String GetCPU_Serioal_No() // this part working
    {
        string cpuID = string.Empty;
        ManagementClass mc = new ManagementClass("win32_processor");
        ManagementObjectCollection moc = mc.GetInstances();
        foreach (ManagementObject mo in moc)
        {
            if (cpuID == "")
            {
                cpuID = mo.Properties["processorID"].Value.ToString();

            }
        }
        return cpuID;
    }

================================================ ============================= 请帮助

1 个答案:

答案 0 :(得分:0)

如果没有协议(例如http://https://),则不是URI

public string _hostName = "http://99bd.net";