使用搜索表单获取结果列表时,它会转到404页面未找到,而是搜索结果页面。
Search Results.cshtml是
<form action="/searchresult/" method="GET">
<input type="text" class="searchfield" placeholder="" name="query">
<button class="searchbtn btn btn-default btn-sm">Search</button>
</form>
@{
var searchQuery = Request.QueryString["query"];
if (!string.IsNullOrEmpty(searchQuery))
{
<div class="searchresults">
<p class="intro-para">Your search results for <strong>"@searchQuery"</strong></p>
<ul>
@foreach (var result in Umbraco.Search(searchQuery))
{
<li>
<a class="heading1 inline-link" href="@result.Url">@result.Name</a>
<div class="heading2">Created Date : @result.CreateDate.ToLongDateString()</div>
<div class="heading2">Updated Date : @result.updateDate.ToLongDateString()</div>
</li>
}
</ul>
</div>
}
}
http://gmohan:8018/searchresult/?query=loan
还有其他人遇到此错误并找到解决方法吗?