如果ASP.NET服务器返回RedirectResult

时间:2015-05-21 12:15:32

标签: c# asp.net dotnet-httpclient

在服务器端,我正在做:

return Redirect(...); // <- doesn't matter which url

在客户端我正在做

await Http.PostAsync

总是会出错...:

1-如果我将其设置为“http://www.google.com”,我会收到错误:

System.Net.WebException: Error getting response stream (ReadDone2): ReceiveFailure ---> System.Exception:    at System.Net.WebConnection.HandleError(WebExceptionStatus st, System.Exception e, System.String where)

2-如果我将它设置为像“/”这样的相对URL,则等待超时:

System.Threading.Tasks.TaskCanceledException: A task was canceled

我长期以来一直坚持这个问题,我终于发现这一切都是因为出于某种原因HttpClient不喜欢被重定向。

当我在Firefox中的RESTClient中测试它时,确切的一些功能完全正常。

有什么想法吗?

编辑:请忽略这个问题,这是Mono的一个问题,完整的简单代码在这里重现: https://forums.xamarin.com/discussion/42410/bug-httpclient-times-out-when-redirected-on-a-post-request

0 个答案:

没有答案
相关问题