tags:

views:

5282

answers:

4

I'm running an c# .net app in an iframe of an asp page on an older site. Accessing the Asp page's session information is somewhat difficult, so I'd like to make my .net app simply verify that it's being called from an approved page, or else immediately halt.

Is there a way for a page to find out the url of it's parent document?

+1  A: 
top.location.href

But that will only work if both pages (the iframe and the main page) are being served from the same domain.

Dan
Exactly what i needed - Thanks!
SpacePenguin
A: 

Space, this URL might help you: http://geekswithblogs.net/ranganh/archive/2005/04/25/37635.aspx

Optimal Solutions
A: 

parent.location.href

81bronco
A: 

Request.UrlReferrer.... to get the URL

NameValueCollection qs = HttpUtility.ParseQueryString(Request.UrlReferrer.Query);... to digest query string

jumpdart