IT researcher
IT researcher

Reputation: 3304

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.

Upvotes: 0

Views: 425

Answers (1)

Nikola Bogdanović
Nikola Bogdanović

Reputation: 3213

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"]).

Upvotes: 1

Related Questions