0

当我捕获一个无效的 URL 时,例如:www.example.com/urlDontExists,我重定向到搜索页面,如下所示:

Response.Redirect("/Search");

但我想将标签“urlDontExists”发送到表单,以查看与我转到“搜索”页面并通过“urlDontExists”搜索的结果相同的结果。

我知道使用 QueryString 是可能的,例如:

Response.Redirect("/Search?searchtag=urlDontExists");

但我不想在 QueryString

这有可能吗?

4

1 回答 1

0

您可以为此使用 jQuery。

$(document).ready(function() {
    // Get the parameters and fill the search form here
    var location = window.location;
    // modify the querystring so that urlDoesntExist is removed from the titlebar
    ...
    window.location.replace(modified_url);
})

请注意,这是一个很大的 hack。

于 2011-03-17T11:53:30.967 回答