【问题标题】:why goddady changes the url on response.redirect为什么 goddady 更改 response.redirect 上的 url
【发布时间】:2018-10-03 08:40:31
【问题描述】:

我在网站 (ASP.Net) 中有一个名为“wcms”的子文件夹,其中包含多个文件,包括“login.aspx”和“index.aspx”。登录页面检查用户名和密码并将页面重定向到 index.aspx。

当我在开发机器上本地运行它时,这工作正常,但是当我调用登录时: https://p3nwvpweb123.shr.prod.phx3.secureserver.net:8443/sitepreview/http/hebron-city.ps/wcms/login.aspx 它切断了一些路径并将我重定向到: https://p3nwvpweb123.shr.prod.phx3.secureserver.net:8443/wcms/index.aspx

可能是什么问题?

【问题讨论】:

  • 您的第一个链接看起来像是预览,可能是 Godaddy 将其重定向到正确的位置
  • 我从 godaddy 中的预览链接打开了网站,httpdoc 文件夹中的其他链接工作正常,当我输入 /wcms/login.aspx 时,它工作正常,但是当它使用以下命令重定向我时:" Response.Redirect("index.aspx", False)" 它将我重定向到错误的 URL
  • 尝试重定向,如 'Response.Redirect("~/wcms/index.aspx",false);'
  • 相同的结果 :(,不工作

标签: asp.net response.redirect


【解决方案1】:

不要依赖所有重定向中的预览链接尝试使用根文件夹中的完整路径,比如这里你的根路径,包括域名是https://p3nwvpweb123.shr.prod.phx3.secureserver.net:8443/,所以重定向你的所有链接,比如

Response.Redirect("~/wcms/index.aspx");
Response.Redirect("~/wcms/login.aspx");

这将消除错误重定向的歧义。

并从 url 调用您的登录页面

https://p3nwvpweb123.shr.prod.phx3.secureserver.net:8443/wcms/login.aspx

不是来自

https://p3nwvpweb123.shr.prod.phx3.secureserver.net:8443/sitepreview/http/hebron-city.ps/wcms/login.aspx 

【讨论】:

猜你喜欢
  • 1970-01-01
  • 2011-11-01
  • 1970-01-01
  • 1970-01-01
  • 2012-05-02
  • 2013-06-07
  • 1970-01-01
  • 2019-12-01
相关资源
最近更新 更多