2014-05-06 103 views
0

我是新來的asp.net。有沒有明顯的原因,爲什麼這不工作?ASP重定向不工作

<% 

If Request.Url.ToString.ToLower.IndexOf("http://www.secondarydomain.com") > -1 Then 
    Server.Transfer("secure/login.aspx") 
Else 
    Response.Redirect("index.php") 

End If 

%> 

我需要的是爲它重定向到「安全/ login.aspx的」當用戶訪問www.secondarydomain.com和它重定向到index.php當用戶vists www.primarydomain.com

目前,www.secondarydomain.com工作正常,但www.primarydomain.com說 「的頁面沒有正確重定向」 的Global.asax

<%@ Application Codebehind="Global.asax.vb" Inherits="CompanyLogin.Global" %> 

內容ROR是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文件的內容:

試圖訪問www.primarydomain.com當Firefox控制檯的
# 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 

截圖:

redirect_console

任何幫助深表感謝。

+0

你得到的實際錯誤是什麼?說實話*「頁面沒有正確重定向」*就像它們來的一樣通用。 – Lankymart

+0

就是你所有的全局文件。應用程序啓動或會話啓動時沒有重定向?如果不是這種情況,請嘗試重置Cookies並檢查。 –

+0

@Lankymart我會得到實際的錯誤。 – RipzCurlz

回答

0

它應該是http://www.website.com而不是website.com。

+0

應該是什麼?對不起,但這有什麼幫助?,OP使用'.IndexOf()'發現任何「website.com」的出現,因此尋找'http:// www.website.com'不會做出區別。 – Lankymart