You cannot do that. An API has no UI and is not even being called by a browser necessarily. Opening the browser has to be done by the code that calls your API. What you should probably do is identify the URL that you want the client to navigate to. Whether that is part of your existing data or passed as an HTTP header depends on what you're doing. Nevertheless the client that called your API is then responsible for opening a browser window to that URL. Your API cannot do that itself.
Open brower from API
ANB
181
Reputation points
My customer calls my Net Core API passing some parameters and after run those, I need to open a browser on his/her computer with some html returning from the API call.
How can I do it ?
Thx
2 answers
Sort by: Most helpful
-
-
ANB 181 Reputation points
2022-09-29T16:20:17.097+00:00 Even though this API run on Net 6 ?
I thought somehow my API could have API Controllers but also MVC Controllers.
Adding services.AddControllersWithViews() and also dependency services.AddTransient<MyMvcController, MyMvcController>() in program.csThen the API Controller would call the MVC Controller and the MVC present its View.