troubleshooting Question

How to use a MVC view to host a rendered React component in an iframe.

Avatar of Bruce_M
Bruce_MFlag for United States of America asked on
ASP.NET.NET MVCUI/UXMicrosoft Visual Studio
4 Comments1 Solution399 ViewsLast Modified:
I had this question after viewing How to use an iframe in mvc.

I'm building a web app for personal financial planning. I've started with a React framework to build the user's interaction, and that is going well. But now I want to use the new ASP.NET Core mvc framework for the main user interface, and use the react code in one of the mvc's views. But I am new to the plumbing used in ASP.NET Core mvc. I have a DOTNET CLI generated framework up and running in Visual Studio Code, with my react project embedded in an Areas folder. It all works in that I can run the mvc on local host by using the VSCode debugger facility, and I can run my react by using npm start to run the Webpack server for my react code under the Areas folder. I build my output in the Areas/frcstr/build folder and I want to provide that index.html to the mvc view to load the rendered React app.

My question is how do I create the empty view to hold the iframe tag? I tried to just use one of the boiler plate views in the generated mvc framwork, but that is compomised some how by Razor with common layouts and such. I just need a plain view to hold this:

<iframe src="../../Areas/frcstr/build/index.html" height="100%" width="100%" style="border:none;"></iframe>

At this point I don't know how to define Controlers, views, etc.

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Log in to continue reading
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform for $9.99/mo
View membership options
Unlock 1 Answer and 4 Comments.
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
See how we're fighting big data
The Value of Experts Exchange in My Daily IT Life

Experts Exchange (EE) has become my company's go-to resource to get answers. I've used EE to make decisions, solve problems and even save customers. OutagesIO has been a challenging project and... Keep reading >>


Owner of Outages.IO
Phoenix, Arizona, United States
Member Since 2016
Join a full scale community that combines the best parts of other tools into one platform.
Unlock 1 Answer and 4 Comments.
View membership options
“All of life is about relationships, and EE has made a virtual community a real community. It lifts everyone's boat.”
William Peck

Member since 2004