I use popular technique "ReturnUrl". I pass current page url to server, do some staff and then i redirect user back to this url. For example, user posts comment and then get back to this url.
@using (Html.BeginForm("AddUserComment", "Home", new { returnUrl = HttpContext.Current.Request.RawUrl }, FormMethod.Post, new { enctype = "multipart/form-data" }))
{
...
}
BUT, when i load this form through ajax call, like this:
$.ajax({
type: 'GET',
url: '/Home/ShowUserCommentsBlock/',
data: { entityType: entityType, entityId: entityId },
cache: false,
...
});
HttpContext.Current.Request.RawUrl returns ajax request url "/Home/ShowUserCommentsBlock?entityType=...", but i need current page url, where ajax request is called.
What should I use instead of HttpContext object?
