string url = ConfigurationManager.AppSettings["CorreURL"].ToString(); https://ourwebsite.com/Transmit
string json = JsonConvert.SerializeObject(claim, Formatting.Indented);
WebRequest request = WebRequest.Create(url);
request.ContentType = "application/json";
request.Method = "GET";
request.Headers.Add("Authorization", "passwordgoesherebuthiddenfromstackoverflow");
Type type = request.GetType();
Object currentMethod = type.GetProperty("CurrentMethod", BindingFlags.NonPublic | BindingFlags.Instance).GetValue(request);
Type methodType = currentMethod.GetType();
methodType.GetField("ContentBodyNotAllowed", BindingFlags.NonPublic | BindingFlags.Instance).SetValue(currentMethod, false);
//i get the error here:
using (StreamWriter streamWriter = new StreamWriter(request.GetRequestStream()))
{
streamWriter.Write(json);
}
我想做的是向我们的服务器发送一个 json 文件(该文件没问题,因为我在 lint 上对其进行了测试)以处理该文件。我们使用邮递员,我从那里得到了信用,但没有运气。我希望这是足够的信息。如果我需要提供更多信息,请告诉我。上面的代码就是刚才隐藏的所有代码。
提前致谢