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?
            Asked
            
        
        
            Active
            
        
            Viewed 8,297 times
        
    1
            
            
        - 
                    Please see [this question](http://stackoverflow.com/questions/1471188/how-do-i-get-the-referrer-url-in-an-asp-net-mvc-action) – Andrei V Jun 03 '14 at 08:21
- 
                    @BorHunter: Can you please re-write the question and give an example of what you are after? – Dominic Zukiewicz Jun 03 '14 at 08:22
3 Answers
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].
- Otherwise check this answer: ASP.NET MVC - Check if request comes from another action
 
     
     
    