Request. UrlReferrer, request. urlreferrer

Source: Internet
Author: User

Request. UrlReferrer, request. urlreferrer

Recently, a function is to feedback statistics, and then add the page from which to click in the feedback suggestion. At first, we plan to add the & url = Method to the link and then accept the parameters on the page, later I learned about the request. urlReferrer knows that he can directly obtain it, And then directly adds the model to the model. url = Request. urlReferrer. tostring (); later I found that all the URLs on the current page were stored in the database, and I had been wondering where the problem was, and then I checked the information online, this attribute can be obtained only when the page is loaded, that is, the url of the previous page is effective only when I add () The actionresult to add the page action, in addition, the method for adding a model actually obtains the url of the current page.

So I used it like this.

// Add comments public ActionResult Add () {if (Request. UrlReferrer! = Null) {// obtain the last accessed url ViewBag. urllast = Request. UrlReferrer. AbsoluteUri when loading the page;} return View ();}

Then, when adding the model, it will be OK to pass the url in viewbag.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.