views:

26

answers:

1

I have this code that is supposed to generate HTML file for google AdSense then navigate through it using the WebBroswerControl in a windows forms application the weird thing is that it produces one link with totally no formatting when it is run through the application.

However, if I double click directly on the produced file, it gives the required result. What could be the problem?

here is my code

         string HTML =
             @"
            <html>
            <script type=""text/javascript"">
            google_ad_client = ""pub-7950118917489847"";
            google_ad_width = 234;
            google_ad_height = 60;
            google_ad_format = ""234x60_as"";

            google_ad_type = ""text"";
            //2008-03-02: hooverwebdesign.com
            google_ad_channel = ""your_ad_channel"";
            google_color_border = ""FFFFFF"";
            google_color_bg = ""FFFFFF"";
            google_color_link = ""0000FF"";
            google_color_text = ""000000"";
            google_color_url = ""008000"";

            google_language = 'en';
            </script><script type=""text/javascript"" src=""http://pagead2.googlesyndication.com/pagead/show_ads.js""&gt;&lt;/script&gt;
            </html>

            ";

        string adsenseFile1 = Environment.CurrentDirectory + "\\adsense1.html";
        using (StreamWriter writer = new StreamWriter(adsenseFile1))
            writer.Write(HTML);
        webBrowser1.Navigate(adsenseFile1);
+1  A: 

WebBrowser control sends a bit different headers, try http://whatsmyuseragent.com/ to investigate.

Dmitry Karpezo