1

I am executing a page where Page contain multiple Tabs and each tab call ajax method to get it's own view.

My problem is when ajax request come on controller then OnActionExecuting method I am not able to get Root(Page) URL.

Root URL like http://www.myapp.com/Profile/MyProfile Ajax URL like http://www.myapp.com/Profile/ManageLocation

protected override void OnActionExecuting(ActionExecutingContext filterContext)
  {
      var url = new UrlHelper(filterContext.RequestContext);
      string urlPath = url.Action();// Get current requested '/Action/Method'

//How to get Root Page URL

}

1 Answer 1

0

You can get original URL from Headers collection:

    public override void OnActionExecuting(ActionExecutingContext filterContext)
    {
        var callFrom = filterContext.HttpContext.Request.Headers["Referer"];
        //Do something
    }
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.