【问题标题】:Response.Redirect not changing URLResponse.Redirect 不改变 URL
【发布时间】:2017-03-17 15:55:47
【问题描述】:

在我的网页上单击一个元素后,我从跟踪中的 Response.Redirect 获得了预期的行为,预期页面上的断点被命中并继续正常处理。但是,当我希望加载新页面时,浏览器中的显示不会改变。它的外观和行为就像单击将您带回同一页面。

我已将重定向调用移出 try-catch 块,并尝试将 true/false 的不同组合作为第二个参数与 HttpContext...CompleteRequest()

在来自 Response.Redirect 的调用和 Page_Load 子程序完成后,什么可能会阻止页面加载?

编辑:
该站点使用 css 和 javascript 创建一个包含自引用链接的可悬停下拉菜单,见下文。我尝试使用 Chrome 的开发工具来查看网络正在处理什么。据我通过阅读网络标签可以看出,点击正在创建正确的呼叫;状态 200,键入 xhr。 xhr 是我唯一觉得奇怪的东西,但看起来这只是对 ajax 的引用?这使我处于相同的位置。我告诉网站重定向到新的 url,我看到网络接受了对该 url 的请求,但地址栏中的 url 没有改变;不是显示的页面。

 $(document).on('click','.navigation', function () {
            loadItems($(this).attr('id'), $(this).attr('itemName'));
            return false;
        }
        );

var loadItems = function (id, itemName) {
    var editInfor =
        {
            "method": "getChildItems",
            "id": id
        };

    $.ajax
        (
            {
                type: "POST",
                url: $.url,
                dataType: "json",
                data: JSON.stringify(editInfor),
                success: function (jsonReply) {

                    $("#chkEnabled").attr('checked', jsonReply.enabled)
                    if (jsonReply.method == 'getChildItems') {

                        $("#childrens").html('');
                        var html = '<table>'
                        if (jsonReply.successfull) {
                            $.each(jsonReply.children, function (i, item) {
                                html += '<tr><td><span class="children">' + item.text + '</span></td><td><a class="moveItemUp btn" href="#" id="moveItemUp' + item.id + '">Move Up <i class="icon-circle-arrow-up"></i></a> <a class="moveItemDown btn" href="#" id="moveItemDown' + item.id + '">Move Down <i class="icon-circle-arrow-down"></i></a></td><td><a href="#" class="removeItem btn btn-danger" id="removeItem' + item.id + '">Remove</a></td></tr>'

                            });
                        }
                        html += '</table>'
                        $($.childrens).html(html);
                    }
                }
            }
        );

【问题讨论】:

  • 您要重定向到的页面是否也有代码可以在加载时将您重定向回原始页面?
  • @NoAlias:不,只是仔细检查了

标签: vb.net redirect asp.net-ajax ascx


【解决方案1】:

请试试这个:

$.mobile.changePage( "/Exmaple.aspx", {

  transition: "pop"

}); 

【讨论】:

  • 这看起来像 javascript,我如何在逻辑中使用它来检查数据库的结果?
猜你喜欢
  • 2013-06-07
  • 1970-01-01
  • 1970-01-01
  • 2012-05-02
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2011-05-19
  • 2011-04-13
相关资源
最近更新 更多