【发布时间】:2014-05-06 07:37:48
【问题描述】:
我是 asp.net 的新手。有什么明显的原因导致这不起作用吗?
<%
If Request.Url.ToString.ToLower.IndexOf("http://www.secondarydomain.com") > -1 Then
Server.Transfer("secure/login.aspx")
Else
Response.Redirect("index.php")
End If
%>
我需要的是当用户访问 www.secondarydomain.com 时它重定向到“secure/login.aspx”,当用户访问 www.primarydomain.com 时它重定向到 index.php
目前,www.secondarydomain.com 工作正常,但 www.primarydomain.com 显示“页面未正确重定向”
Global.asax 的内容
<%@ Application Codebehind="Global.asax.vb" Inherits="CompanyLogin.Global" %>
Chrome 给出的错误:
The webpage at http://primarydomain.com/index.php has resulted in too many redirects. Clearing your cookies for this site or allowing third-party cookies may fix the problem. If not, it is possibly a server configuration issue and not a problem with your computer.
Error code: ERR_TOO_MANY_REDIRECTS
另外,我不确定这是否会导致问题,但 index.php 文件用于 WordPress 安装,这里是 WordPress .htaccess 文件的内容:
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
尝试访问 www.primarydomain.com 时的 FireFox 控制台屏幕截图:
非常感谢任何帮助。
【问题讨论】:
-
你得到的实际错误是什么?,说实话“页面没有正确重定向”就像它们来的一样通用。
-
就是你全局文件中的全部内容。应用程序启动或会话启动时没有重定向?如果不是这样,请尝试重置 Cookie 并检查。
-
@Lankymart 我会得到实际的错误。
-
@KrunalPatil 这就是全局文件中的所有内容。我会再次尝试重置 cookie。
-
重置 cookie 无效。我已将错误和 .htaccess 文件的内容添加到我的问题中。