我通过C#代码调用网站URL时遇到错误。 getresponse()错误是500内部服务器错误

我通过C#代码调用网站URL时遇到错误。 getresponse()错误是500内部服务器错误

问题描述:

使用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.