Click here to Skip to main content
15,880,608 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I need to display a website in a CSHTML file. I could not display many of the secured websites. what is the solution to display any website in my page.

Thanks in advance!

What I have tried:

I used iframe but I could not display many of the secured websites. So I want to place a browser control like chrome in my page. Is it possible? Or what is the solution to display any website in my page.

Thanks in advance!
Posted
Updated 12-Jan-21 5:41am
Comments
Dave Kreskowiak 12-Jan-21 12:02pm    
You cannot embed a browser control designed for other app types, like Windows Forms or WPF, in a web page.
sunpop 13-Jan-21 12:25pm    
Yes.. but is there any way to display a webpage inside my page?

1 solution

You cannot embed an https site within an http site.

And most sites will specify a content security policy[^] or the X-Frame-Options header[^] to prevent their site from being embedded within other sites.

You cannot circumvent this. You need to find another way to do what you're trying to do.
 
Share this answer
 
Comments
thatraja 13-Jan-21 1:19am    
5!
sunpop 13-Jan-21 12:19pm    
Thank you @Richard Deeming
But any suggestion to achieve this?
Richard Deeming 13-Jan-21 12:21pm    
As I said, you can't. You'll need to get the other sites to cooperate with you if you want to embed them in your own site.
sunpop 13-Jan-21 12:31pm    
Yes.. I got your point. Can you suggest any other site to support this in Web Application? Because I was able to find sites which support Web Forms & WPF
Richard Deeming 13-Jan-21 12:36pm    
Once again: without the cooperation of the site owners, you CANNOT embed another site in your own site.

You can do it in a desktop application, simply because that's how browsers work. If you can convince users to install and use your application, then you're essentially free to do whatever you want around the edge of the control that displays the website.

You CANNOT do it in a web application. Quite apart from the security implications, no site owner wants their hard work to be shown surrounded by your ads, making you money.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900