1

I have asp.net mvc 4 application, where I need to do some action when I came from HomeController ActionResult DoSmth(). How can I check this?

BorHunter
  • 893
  • 3
  • 18
  • 44

3 Answers3

3

I use

     Request.UrlRefferer

To do this.

8bitcat
  • 2,206
  • 5
  • 30
  • 59
2

You can use the following

var controller = (string)this.RouteData.Values["controller"]; var action = (string)this.RouteData.Values["action"];

3dd
  • 2,520
  • 13
  • 20
0

Not sure if relevant, but if you want to make sure that action is rendered only from your code you can use attribute [ChildActtion].

Community
  • 1
  • 1
cpoDesign
  • 8,953
  • 13
  • 62
  • 106