0

I have submission form developed in Classic ASP. How to get the 2nd previous visited URL through ASP code? I cannot use query string option as i have embedded the form in SP2013 web page. Any suggestions/help?

  • 1
    `request.ServerVariables("HTTP_REFERER")` will give you the url of the page from which the user arrived, and it should be easy enough for you to use this to populate a hidden form field. I don't think there's a way of going back two pages, other that by using javascript to look at your browser history – John Feb 15 '16 at 14:30
  • 1
    Like @John say's there is nothing stopping you using `Request.ServerVariables("HTTP_REFERER")`. You could then keep adding to a `Session` variable a delimited list of URLs or store an `Array`. You might want to limit the number of entries though but that gives you a simple enough starting point. – user692942 Feb 15 '16 at 14:36
  • In fact thinking about it you don't even need to use `Request.ServerVariables("HTTP_REFERER")` you could just have a `#include` file that updates a `Session` variable which then gives you a breadcrumb for every page you have the `#include` file included in. – user692942 Feb 15 '16 at 15:13
  • For a similar problem, I stored it in a cookie. – Vixed Feb 15 '16 at 17:42
  • 1
    @Vixed It's the same thing at the end of the day Classic ASP `Session` objects are stored in session cookies. The advantage of using your own cookie is it can persist for longer. – user692942 Feb 16 '16 at 09:41
  • @Lankymart just delete it after the redirect ;) – Vixed Feb 16 '16 at 11:26
  • @Vixed: Why bother? Just use a Session. – Paul Feb 16 '16 at 14:25
  • @Paul are you a squanderer or what?! Tell me why I have to store a session for each user on my server while I can put it on a client pc! This explanation is the same for ASP: http://stackoverflow.com/questions/6339783/what-is-the-difference-between-sessions-and-cookies-in-php – Vixed Feb 16 '16 at 14:47
  • @Vixed: There's an overhead either way. If you put it in a cookie you have a speed overhead. If you put it on the server you have a memory overhead. The choice is yours. – Paul Feb 16 '16 at 15:24
  • @Vixed: [This is an interesting discussion](http://stackoverflow.com/questions/2240556/when-should-i-use-session-variables-instead-of-cookies) on when to use which. – Paul Feb 16 '16 at 16:17

0 Answers0