Reputation: 2577
I am using Ajax.BeginForm to submit data etc, but when I look at Request.Url etc I get the URL of the Ajax request. Is there a way I can get URL of the actual page the user is on?
Basically, I need to obtain id (routevalue) from the URL without passing anything to the Ajax-actionlink.
Upvotes: 0
Views: 882
Reputation: 6654
You could try using the UrlReferrer
property of the HttpRequest
class. I'm not sure if it will work on every case of your application, but you could give it a try.
Upvotes: 0
Reputation: 1038720
Why not directly pass the information you need in the request:
<%: Ajax.ActionLink(
"Some link text",
"ActionName",
// Notice how the id value is extracted from the route
// and used to construct the link
new { id = RouteData.Values["id"] },
new AjaxOptions { OnSuccess = "success" }
) %>
Upvotes: 1