1

I have a child page (e.g. http://www.domain.com/childpage.aspx) within a parent page (e.g. http://www.domain.com/parentpage.aspx) using an iframe.

I'd like to know what the URL of the parent page is using server-side code. would that be possible?

Request.Browser gives the URL of the child page only.

I also checked Request.UrlReferrer which contains the parent page URL only the first time the page loads. As soon as I click on a link inside the child page, the Request.UrlReferrer won't be the parent page any more, it will be the previous page.

I'd like to know what the URL of the parent page is using server-side code.

4

1 回答 1

0

您无法在服务器端找到这一点,就所有意图和目的而言,就好像请求来自不同的网页一样。

您唯一的希望是使用客户端脚本获取 URL 使用 ajax 将 URL 发送到服务器。请记住,这仅在页面位于同一域中时才有效。如果不是,您将遇到单点来源限制问题。

于 2012-12-06T09:44:12.327 回答