简体   繁体   中英

RedirectToAction - how to go back 2 pages back?

At the end of my ActionResult method I have

return RedirectToAction(Request.UrlReferrer.ToString());

which redirect to the previous page. Is there any way to redirect it to two or three pages back?

One way is to have a list of four Uri s stored in Session and for each request, to push away the olders and push current Uri - Request.RequestUri .

When going back just choose one of the oldest within the stored Uris.

However, you can consider using Html5 history API, as indicated here .

I think the answer you looking for can be found here.

How to use RedirectToAction to redirecto to a position in the page?

Hope it helps.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM