Obtain View name in Controller, ASP.NET MVC

前端 未结 4 866
悲&欢浪女
悲&欢浪女 2021-01-25 05:07

I am using asp.net mvc. I have 4 pages that show list of events(different type of events) and \"Details\" link on each page leads to \"EventDescription.aspx\" View.

The

4条回答
  •  别那么骄傲
    2021-01-25 05:39

    if you just want to get the Url where you came from you can do this in your Action

    ViewData["ReturnPath"] = this.Request.UrlReferrer.AbsolutePath;
    

    This give you the Url of the page where you came from. If your from Page1 then you go to EventDescription. In your EventDescription Action, your ReturnPath ViewData has the Url of Page1. Or Vice Versa.

提交回复
热议问题