相关疑难解决方法(0)

RedirectToAction不起作用

RedirectToAction在我向控制器发送了一个帖子并保存之后我尝试使用了一个但是URL没有改变,重定向似乎不起作用.我需要补充一点,重定向确实在我调试时进入控制器动作方法.它不会更改URL或导航到Index视图...

public ViewResult Index()
{
    return View("Index", new TrainingViewModel());
}

public ActionResult Edit()
{
    // save the details and return to list
    return RedirectToAction("Index");    
}
Run Code Online (Sandbox Code Playgroud)

我究竟做错了什么 ?

public static void RegisterRoutes(RouteCollection routes)
{
    routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
    routes.IgnoreRoute("{resource}.js/{*pathInfo}");
    routes.IgnoreRoute("{*favicon}", new { favicon = @"(.*/)?favicon.ico(/.*)?" });

    routes.MapRoute(
        "Default", // Route name
        "{controller}/{action}/{id}", // URL with parameters
        new { controller = "Home", action = "Index", id = "" } // Parameter defaults
    );
}
Run Code Online (Sandbox Code Playgroud)

// JQUERY CALLS

this.SynchValuesToReadOnly = function() {
    window.location …
Run Code Online (Sandbox Code Playgroud)

asp.net-mvc

31
推荐指数
4
解决办法
7万
查看次数

标签 统计

asp.net-mvc ×1