I’m working on MVC project and I have to use web forms control there. I can include whole page in iframe in my mvc project view that’s not a problem. That kind of behavior is acceptable.
But I have a problem with data I need to exchange. I want to send some data from the controller there and also get some response after control end its work. To be more specific:
1. Send some initial values to the web control from controller on start.
2. Something like “magic” button in web forms when it’s clicked I have post back to the controller with some data generated by the control.
Is this even possible?
This certainly is possible. You could use an
iframeto host the legacy WebForm inside the ASP.NET MVC application. Let’s suppose for example that you have the following ASP.NET MVC controller:with the corresponding
~/Views/Home/Index.cshtmlview:and the following
~/WebForm1.aspx:In this example I supposed that the WebForm is part of the MVC application which allows us to use helpers to generate the links between them. Of course if this is not the case you must use absolute urls to link between the 2 applications.