Request.IsAjaxRequest never returns true in MVC3

后端 未结 5 545
眼角桃花
眼角桃花 2021-01-15 14:22

I am using Asp.net MVC3 and trying to do a simple Ajax post to the server which returns a partial view and updates my list of items during a search.

    @usi         


        
5条回答
  •  隐瞒了意图╮
    2021-01-15 14:44

    var controllerContext = MockRepository.GenerateMock();
    controllerContext.Expect(c => c.HttpContext.Request["X-Requested-With"]).Return("XMLHttpRequest");
    controller.ControllerContext = controllerContext;
    

提交回复
热议问题