将数据发布到iframe(aspx)以在aspx页面的页面加载中捕获它

Post a data to iframe(aspx) to capture it in Page load of aspx page

本文关键字:aspx 加载 数据 iframe 以在      更新时间:2023-09-26

我有一个HTML页面和一个iframe(aspx页面),如下所示。

Mypage.htm

<div>
<iframe name="Frame1" id="ff1" src="http://example.com/example.aspx" frameborder="0" scrolling="no" height="600" width="500" style="text-decoration:none;" marginwidth="5"></iframe>
</div>

此Mypage.htm将作为用户单击的其他页面的链接提供,并且Mypage.htm在新选项卡中打开。

我想将数据发布到iframe。发布的数据是"网站"="真实"(发布的数据只是一个标识,是固定的)。发布的数据在iframe中的aspx页面的page_load中捕获。

所以现在我很困惑如何将数据发布到框架以及在哪个事件中。我应该能够在aspx页面的页面加载中获得发布的数据。如何做到这一点。

只需使用一个查询字符串而不是发布数据:

<div>
    <iframe name="Frame1" id="ff1" src="http://example.com/example.aspx?website=true" frameborder="0" scrolling="no" height="600" width="500" style="text-decoration:none;" marginwidth="5"></iframe>
</div>

并且在Page_Load中检查Request.QueryString["website"](而不是Request.Form["website"])。