Why my app shows only a few lines of HTML-code of a webpage, and IE shows it all.

Hi there,

I have searched on the internet for examples to get the whole HTML-code of a certain webpage. Alle these examples just get me a few lines. The strangest thing is when I take f.e: Internet Explorer, right-click on it and choose Display Source in the context-menu I get a new windows with all the HTML-code of that page. When i do the same with Mozilla Firefox I get also a few lines. Does someone know why my application and Firefox shows only a few lines of code and IE shows it all. Who knows why, and how to solve this problem in my application.

Greetings, Peter Kiers
LVL 1
Peter KiersOperatorAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

carloselfaiteCommented:
can you provide the webpage url?
Peter KiersOperatorAuthor Commented:
Unfortunally not. The url is an url i have logged into. Peter
Dave BaldwinFixer of ProblemsCommented:
It is difficult to help you when you can't give the info to check the problem.  However... it sounds like there may be an error on that page.
CompTIA Security+

Learn the essential functions of CompTIA Security+, which establishes the core knowledge required of any cybersecurity role and leads professionals into intermediate-level cybersecurity jobs.

Peter KiersOperatorAuthor Commented:
I have a webbrowser on my form that displays a page. When I right-click on the webbrowser and select display source in the context-menu i get the full html of that page. I have also create a button with the following code:

        private void bbGetHtml_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            String source = ("source.txt");
            StreamWriter writer = File.CreateText(source);
            writer.Write(webBrowser1.DocumentText);
            writer.Close();
            Process.Start("notepad.exe", source);
        }

Open in new window


I get only a few lines.

How can I sove this?

Greetings, Peter Kiers
Peter KiersOperatorAuthor Commented:
And I like to mention that the website uses a frameset!

Maybe that is the problem. But how to solve this?



Peter
Peter KiersOperatorAuthor Commented:
AAAAAAAAAAAAAAAAHHH GOT IT:

The reason why I only get a few lines of a site. Is because the site uses a frameset:

And this does the trick:

string html = string.Empty;

// webBrowser1.Document.Window.Frames gets a collection of iframes contained in the current document...
// HTMLWindow is the iterator for the Collection...
foreach (HtmlWindow frame in webBrowser1.Document.Window.Frames)
{
html += frame.Document.Body.OuterHtml;
}

Open in new window


Greetings, Peter Kiers

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Peter KiersOperatorAuthor Commented:
Found my own solution
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
C#

From novice to tech pro — start learning today.