Nick
Nick

Reputation: 19684

Redirecttoaction is not redirecting

How do I redirect to another action in my controller correctly? When the redirecttoaction is called in the code below the code does not branch to the "Javascript" action. What am I missing? Thanks!

  public ActionResult Build(
        string uid,
        string release,
        string localization,
        string label,
        string sessionid,
        FormCollection formCollection)
    {
        if (!FormValid(uid, release)) return Index();

        if (formCollection["sxgenre"] == "Mobile")
        {
            RedirectToAction("Javascript",
                             new
                                 {
                                     uid = uid,
                                     release = release,
                                     localization = localization,
                                     label = label,
                                     sessionid = sessionid
                                 });
        }

Upvotes: 0

Views: 639

Answers (1)

Darin Dimitrov
Darin Dimitrov

Reputation: 1039428

You need to return:

if (formCollection["sxgenre"] == "Mobile")
{
    return RedirectToAction(
        "Javascript",
        new
        {
            uid = uid,
            release = release,
            localization = localization,
            label = label,
            sessionid = sessionid
        });
}

Upvotes: 1

Related Questions