简体   繁体   中英

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

I have a HTML page and an iframe(aspx page) in it as shown below.

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>

This Mypage.htm will be given as a link from other pages where user clicks and Mypage.htm opens in new tab.

I want to post data to the iframe. posted data is "website"= "true"(posted data is just an identification and is fixed) . The posted data is captured in page_load of the aspx page which is in iframe.

So now i am confused like how to post data to frame and at which event. I should be able to get posted data in the page load of aspx page. How it can be done.

Simply just use a query string instead of the post data:

<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>

And in Page_Load check for Request.QueryString["website"] (instead of Request.Form["website"] ).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM