简体   繁体   English

内容配置的HttpWebRequest.AllowAutoRedirect问题

[英]HttpWebRequest.AllowAutoRedirect problem with Content-Disposition

If you set AllowAutoRedirect of HttpWebRequest to true , then it automatically redirects until it reaches some content. 如果将HttpWebRequest AllowAutoRedirect设置为true ,则它将自动重定向直到到达某些内容。 For example on sourceforge.net it redirect to mirror and then mirror would return the content in response. 例如,在sourceforge.net它重定向到mirror,然后mirror将作为响应返回内容。 Problem is, the final response doesn't contain any Content-Disposition header, instead it's prior response has one, which redirect us to the last URL where download begins. 问题是,最终响应不包含任何Content-Disposition标头,而它的先前响应只有一个,它将我们重定向到开始下载的最后一个URL。 If AllowAutoRedirect is set to true then we miss the file name and if set to false, we should redirect manually and keep an eye out for Content-Disposition . 如果AllowAutoRedirect设置为true那么我们会错过文件名;如果设置为false,我们应该手动重定向并注意Content-Disposition Any idea ? 任何想法 ?

Seems to me like a broken webapp. 在我看来,就像一个破碎的Web应用程序。 Anyhow, I would work around it by doing the redirects manually, instead of being handled by HWR. 无论如何,我将通过手动进行重定向来解决此问题,而不是由HWR处理。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM