josephdaviskcrm
asked on
ASP.NET - What page did I come from?
In an ASP.NET application (C#)
I'm working with a site map bread crumb control that needs to have the last page in the trail be a link back to that page. I've been trying to accomplish that so far by using Request.UrlReferrer. This works fine under normal circumstances, but I'm worried about it failing in other circumstances.
For instance, when I come to a page with this control on it by using javascript window.loacation = "path"; the urlReferrer is null. I've thought about trying some work around where I add an anchor element to the page using the javascript and then force a click event on that anchor, but I would rather not have to write such sloppy code like that if I can avoid it.
Are there any best practices that should be implemented in a situation like this to help a page know where the user was coming from before they came to that page?
Thanks
I'm working with a site map bread crumb control that needs to have the last page in the trail be a link back to that page. I've been trying to accomplish that so far by using Request.UrlReferrer. This works fine under normal circumstances, but I'm worried about it failing in other circumstances.
For instance, when I come to a page with this control on it by using javascript window.loacation = "path"; the urlReferrer is null. I've thought about trying some work around where I add an anchor element to the page using the javascript and then force a click event on that anchor, but I would rather not have to write such sloppy code like that if I can avoid it.
Are there any best practices that should be implemented in a situation like this to help a page know where the user was coming from before they came to that page?
Thanks
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
what do I do in situations where the return url has a query string of its own?
So if I came from http://www.xyz.com/firstpage.aspx?id=123
The path that I would set for the page would be
http://www.xyz.com/otherpage.aspx?ReturnTo=/firstpage.aspx?id=123
So there are now two '?' in my url
So if I came from http://www.xyz.com/firstpage.aspx?id=123
The path that I would set for the page would be
http://www.xyz.com/otherpage.aspx?ReturnTo=/firstpage.aspx?id=123
So there are now two '?' in my url
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks
Request.ServerVariables("H