我通过C#代码调用网站URL时遇到错误。 getresponse()错误是500内部服务器错误 [英] I am getting error while calling website URL through C# code. The error is 500 internal server error at getresponse()
问题描述
使用httpwebrequest create(url)方法调用url时收到错误
远程服务器返回错误:(500)内部服务器错误
//这是代码
string downloadurl =http:// Localhost:1005 / Checker。 mvc?lvl = s3cr3tkeySTX& user = ITB-Testing& company = ITBright& country = BE& warp = pu;
try
{
Uri url = new Uri(downloadurl);
System.Net.HttpWebRequest request =(System.Net.HttpWebRequest)System.Net.HttpWebRequest.Create(url) ; //)System.Net.WebRequest.Create(url);
System.Net.HttpWebResponse response =(System.Net.HttpWebResponse)request.GetResponse();
response.Close();
}
我的尝试:
尝试
{
// str urlForDownload = DownloadUrl;
Uri url = new Uri(downloadurl);
System.Net.HttpWebRequest request =(System.Net.HttpWebRequest)System.Net.HttpWebRequest。创建(URL); //)System.Net.WebRequest.Create(url),
System.Net.HttpWebResponse response =(System.Net.HttpWebResponse)request.GetResponse();
response.Close();
}
上面的代码我试过
while calling url using httpwebrequest create(url) method i am getting error as
The remote server returned an error: (500) Internal Server Error
//Here is the code
string downloadurl=""http://Localhost:1005/Checker.mvc?lvl=s3cr3tkeySTX&user=ITB-Testing&company=ITBright&country=BE&warp=pu";
try
{
Uri url = new Uri(downloadurl);
System.Net.HttpWebRequest request = (System.Net.HttpWebRequest)System.Net.HttpWebRequest.Create(url); //)System.Net.WebRequest.Create(url);
System.Net.HttpWebResponse response = (System.Net.HttpWebResponse)request.GetResponse();
response.Close();
}
What I have tried:
try
{
// string UrlForDownload = DownloadUrl;
Uri url = new Uri(downloadurl);
System.Net.HttpWebRequest request = (System.Net.HttpWebRequest)System.Net.HttpWebRequest.Create(url); //)System.Net.WebRequest.Create(url);
System.Net.HttpWebResponse response = (System.Net.HttpWebResponse)request.GetResponse();
response.Close();
}
This above code i tried
推荐答案
500错误意味着网站代码崩溃了。代码编写得不好,或者您在URL中发送的参数导致代码中没有预料到的条件或两者兼而有之。
The 500 error means that the website code crashed. Either the code was badly written or the parameters you sent in the URL caused a condition in the code that was not anticipated or both.
这篇关于我通过C#代码调用网站URL时遇到错误。 getresponse()错误是500内部服务器错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!