Hello everyone please let me know how to call a OnPost Method using iframe in razor pages.
Iframe in razor pages.
3 Answers
Know the answer? Post it. Somebody with the same question will find it here.
Hello everyone please let me know how to call a OnPost Method using iframe in razor pages.
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Ankush Verma129 reputationPosted Jan 17, 2023, 6:11 AM EST
I have use razor not MVC
Vishal YelveRank #178 · 13.6K reputationPosted Jan 19, 2023, 9:00 AM EST
Hi Ankush,
Please refer below links
https://stackoverflow.com/questions/53840958/asp-razor-page-return-400-code-when-post-form-from-iframe
https://www.aspsnippets.com/Articles/Using-the-OnPost-handler-method-in-ASPNet-Core-Razor-Pages.aspx
Naimish MakwanaRank #324 · 7.7K reputationPosted Jan 17, 2023, 5:52 AM EST
Try to set a name for the elements
iframeand target your form to post on this element, for sample:and in your View inside the iFrame
@using(Html.BeginForm("Action", "Controller", FormMethod.Post, new { target = "foo" }) { .. }Thanks