Adding a HTML Control IN C# in a web application
I want to add 开发者_StackOverflowa html control in C# which will display all the text from an html page selectively with the title given in my html page
Don't forget that when you are programming in ASP.NET, you are really programming in HTML. ASP.NET controls have their effect by generating HTML, which is then sent to the browser.
This changes your question. Your question is really, "how can I use HTML to display the contents of another web site, and how can I make ASP.NET generate the HTML that I need".
You can display the contents of another site by using an iframe
:
<iframe id="myOtherSite" src="other site url"/>
You can simply place that on your ASP.NET page. However, it doesn't solve your problem with the title. I expect you can do that with some JavaScript, as your main window can access the DOM of the iframe to pick up the title and put it where you want it.
You could always use a string reader to effectively 'scrape' the page content from the 3rd party site. Then use a simple regular expression check to grab the page title. You could then do with it as you want.
精彩评论