itsbpk
itsbpk

Reputation: 85

MVC page ajax request base URL

While making an ajax request to a Controller action I'm trying to get the url of the page from which the ajax request is being triggered.

Using Request.RawUrl in the action is returning the ajax request url as the current request in ajax request. Is there any way to know the actual url of the page from which the ajax request is being triggered.

Upvotes: 0

Views: 608

Answers (1)

Jason Evans
Jason Evans

Reputation: 29186

In your controller method use

Request.UrlReferrer

This should give you the url of the ajax request's origin.

Upvotes: 1

Related Questions