【问题标题】:Redirect the URl on different domain重定向不同域上的 URl
【发布时间】:2017-11-30 08:53:54
【问题描述】:

我的域名是

 https://test.org

从经典的 asp 代码,我重定向到下面的 Rest api URL

https://test.api.org/xyz

它访问了我的控制器,并希望将重定向响应发送到另一个 URL

  string redirectResponse= "https://fake.net/mnopqrs"
  var response = Request.CreateResponse(HttpStatusCode.TemporaryRedirect);
  UriBuilder uriBuilder = new UriBuilder(redirectResponse);
  response.Headers.Location = uriBuilder.Uri;
  return response;

而是它重定向到它重定向到 URL

https://test.api.org/mnopqrs 

改为

https://fake.net/mnopqrs

我在这里做错了什么。它在我的本地机器上工作正常,但不是功能环境。

我尝试改用 HttpStatusCode.moved 但没有成功。

【问题讨论】:

    标签: c#-4.0 asp.net-web-api


    【解决方案1】:

    如果您使用 UrlRewrite,它可能会导致此行为。

    【讨论】:

      猜你喜欢
      • 2014-04-06
      • 2015-09-14
      • 2023-02-01
      • 1970-01-01
      • 2015-03-15
      • 1970-01-01
      • 1970-01-01
      • 2012-02-15
      • 1970-01-01
      相关资源
      最近更新 更多