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.
我使用iframe在父页面(例如http://www.domain.com/parentpage.aspx)中有一个子页面(例如http://www.domain.com/childpage.aspx)。
I'd like to know what the URL of the parent page is using server-side code. would that be possible?
我想知道父页面的URL是使用服务器端代码的。那有可能吗?
Request.Browser
gives the URL of the child page only.
Request.Browser仅提供子页面的URL。
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.
我还检查了Request.UrlReferrer,它只在第一次加载页面时包含父页面URL。一旦我点击子页面内的链接,Request.UrlReferrer将不再是父页面,它将是上一页。
I'd like to know what the URL of the parent page is using server-side code.
我想知道父页面的URL是使用服务器端代码的。
1 个解决方案
#1
0
You cannot find this out server side, to all intents and purposes it is as if the requests came from separate web pages.
你无法找到这个服务器端,所有意图和目的就好像请求来自不同的网页。
Your only hope would be to get the URL using client script send the URL to the server using ajax. Bare in mind this will only work if the pages are on the same domain though. If not you will run into single point of origin restriction issues.
您唯一的希望是使用客户端脚本获取URL,使用ajax将URL发送到服务器。请记住,只有当页面位于同一个域时才会起作用。如果不是,您将遇到单点原点限制问题。
#1
0
You cannot find this out server side, to all intents and purposes it is as if the requests came from separate web pages.
你无法找到这个服务器端,所有意图和目的就好像请求来自不同的网页。
Your only hope would be to get the URL using client script send the URL to the server using ajax. Bare in mind this will only work if the pages are on the same domain though. If not you will run into single point of origin restriction issues.
您唯一的希望是使用客户端脚本获取URL,使用ajax将URL发送到服务器。请记住,只有当页面位于同一个域时才会起作用。如果不是,您将遇到单点原点限制问题。