Using MVC 3, a user gets to a URL like app/Controller/Details/123
An $.ajax request on the page posts back to /Controller/AnotherAction.
Inside AnotherAction, I want to get the IDNumber seen in the browser…
I’ve tried looking at the Request object but they all return Controller/AnotherAction:
HttpContext.Request.Path,
HttpContext.Request.Url.AbsolutePath,
HttpContext.Request.RawUrl,
HttpContext.Request.Url.ToString()
Is there any way to get the ID number from Details that the browser is seeing?
If you are checking it in the action method which is being invoked by your ajax call, All those
RequestProperties will give you the information about your current Ajax request. Not the one you have in your address bar.You need to exclusively pass the relevant IDs / key as parameters of the action method and use those.