I have a link in a master page that says "Send feedback" which brings up a new web page.
When I go to that new page, I have a form and I want to populate a textbox with the URL that the person was on when they clicked the "Send Feedback" button.
How can I grab the current URL to pass that over? Should I do this on the client side (jQuery) or on the asp.net-mvc server side?
There is no need to pass along the URL as you can check the UrlReferrer
property on the Request
object in the "Send feedback" action.
Use this as your controller action:
public ActionResult SendFeedback(string message) {
var referrer = Request.UrlReferrer;
feedbackService.Send(message, referrer);
}