Is there a way to get the parent URL from an Iframe's content?

前端 未结 3 922
一生所求
一生所求 2020-12-03 18:08

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 a

相关标签:
3条回答
  • 2020-12-03 18:37
    parent.location.href
    
    0 讨论(0)
  • 2020-12-03 18:49
    top.location.href
    

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

    0 讨论(0)
  • 2020-12-03 18:59

    To get the URL:

    Request.UrlReferrer....
    

    To digest the query string:

    NameValueCollection qs = HttpUtility.ParseQueryString(Request.UrlReferrer.Query);
    
    0 讨论(0)
提交回复
热议问题