简体   繁体   中英

How do I return a user back to the page they came from after filling out a contact form?

I have a website in VB/asp.net 4 and a client may be on a page that says "contact an engineer" and it brings you to a contact form. After filling out the form, it says:

Your message has been sent. Thank you for contacting USS Vision. A member of the engineering team at USS Vision will respond to you at the earliest convenience.

I want to add a hyperlink saying "Return to the page you came from" and have them click it and go back to that page. Is this possible, and if so, how would I go about doing it? Thanks for any help anybody can offer!

Maybe document.referrer or window.history can help you.

UPDATE:

Based on comments to this answer I'm also suggesting to retrieve HttpRequest.UrlReferrer when user comes and save it in Session, then use it anywhere you need.

Unless there's some compelling reason to have them leave the page they're on, it'd probably be easiest -- and a better user experience -- to handle that by opening the contact form in a modal window; the user fills out the form, submits it, receives an acknowledgment, and closes the modal, no muss no fuss.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM