Take the 2-minute tour ×

I'm building an application in C# to retrieve information from my bank account. So far, I'm able to connect to my bank account on https://accesd.desjardins.com. I first enter my card number and than my password on another page. Like this :

    private void newweb_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
        switch (iStages)
            case 1:
                newweb.Document.GetElementById("card_num").SetAttribute("value", strCardNum);
                iStages = 2;
            case 2:
                newweb.Document.GetElementById("passwd").SetAttribute("value", psswd);
                iStages = 3;


But once I'm on my bank account page, I can't no longer use newweb.Document.GetElementById(..) to retrieve any html tags or elements. I want to get my total amount of money. But when I try to get any elements of the page, I always get a null element. When I tried to get the html source code of the page on Chrome, I got a html source code of a page saying that I do not have the permission to see the source code of the page (which is the one with my bank account). I was wondering how to get the source code by any means with C#. There is certainly a way of doing it, since the browser can show the web page. It must have read the source code in order to display it...


share|improve this question

2 Answers 2

This is what you're looking for:

mshtml.HTMLDocument htmlDoc = (mshtml.HTMLDocument)wb.Document.DomDocument;
var yourValue = htmlDoc.getElementById("[SomeID");
share|improve this answer
I'm still getting the HTML source code of the page saying I don't have the permission ! It's weird. –  yhcowboy Jul 2 '12 at 17:32

I've run into something similar before. You need to make sure that you are sending the cookies back with each web request. Banks store cookies that serve as flags that you're logged in. In addition, the connection is using SSL, so make sure that you've taken that into account in your code as well.

share|improve this answer

Your Answer


