我需要在 c# 中将本地路径传递给 HttpWebRequest。我的 C 盘中有 test.xml,我需要在HttpWebRequest
. 但它会引发异常
HttpWebRequest rqst = (HttpWebRequest)HttpWebRequest.Create(Uri.EscapeUriString(urlServ))
行“无效的 URI:无法解析授权/主机。”
我的编码->
string urlServ = "file:\\c:\\test.xml";
try
{
HttpWebRequest rqst = (HttpWebRequest)HttpWebRequest.Create(Uri.EscapeUriString(urlServ));
rqst.KeepAlive = false;
}
catch{}