ASP. NET MVC Redirecttoroute class

Source: Internet
Author: User

There are two methods associated with Redirecttoroute in a controller class: Redirecttoaction () and Redirecttoroute ().

1, Redirecttoaction ()

? Go to another action of the same controller

protected Internal Redirecttorouteresult redirecttoaction (string actionname);
 Public ActionResult Index () {    return redirecttoaction ("List");}

? Go to the action of the specified controller

protected Internal Redirecttorouteresult redirecttoaction (stringstring controllername);
 Public ActionResult Index () {    return redirecttoaction ("List " Member " );}

? Go to Membercontroller's list action method and add "page" to this RouteValue value

protected Internal Redirecttorouteresult redirecttoaction (stringstringobject routevalues);
 Public ActionResult Index () {    return redirecttoaction ("List " Member " New 2  });}

2, Redirecttoroute ()

? Go to another action of the same controller

protected Internal Redirecttorouteresult Redirecttoroute (object routevalues);
 Public ActionResult Index () {    return redirecttoroute (new"List")  });}

? Go to the action of the specified controller

 Public ActionResult Index () {    return redirecttoroute (new {controller="Member  "List"  });

? Go to Membercontroller's list action method and add "page" to this RouteValue value

 Public ActionResult Index () {    return redirecttoroute (new"Member")  "List"3  });

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.