2013-08-26 75 views
0

我們有一個404頁面。當我們在404頁面時,我們有搜索框。如果我們試圖從搜索框中搜索,它會再次返回到404頁面。我們該如何處理?在404頁搜索返回404頁返回

PS:我的搜索按鈕位於用戶控件內,用戶控件位於主頁內。

當我們去下面的網站; http://www.x.com/dk

它進入404

那麼如果我們從搜索日,S 404頁,它指導我們下面的鏈接; http://www.x.com/dk?404%3bhttp%3a%2f%2fwww.x.com%3a80%2fdk

我的web配置設置

<customErrors mode="Off" defaultRedirect="Error.aspx"> 
     <error statusCode="404" redirect="PageNotFound.aspx" /> 
    </customErrors> 
    <httpErrors> 
    <remove statusCode="404" subStatusCode="-1" /> 
    <error statusCode="404" path="/PageNotFound.aspx" prefixLanguageFilePath=""   responseMode="ExecuteURL" /> 
    </httpErrors> 

回答

0

我通過javascript

<script type="text/javascript"> 

    $("#btnSearch").attr("onclick", "Search('/Search.aspx?text=' + encodeURI($('#txtSearchInput').val())); return false;"); 

    function Search(text) { 
     location.href = text; 
    } 

</script> 
解決了這個問題