我有这个代码应该为Google AdSense生成HTML文件,然后使用Windows窗体应用程序中的WebBroswerControl在其中导航 奇怪的是,当它通过应用程序运行时,它会产生一个完全没有格式化的链接。
但是,如果我直接双击生成的文件,它会提供所需的结果。可能是什么问题?
这是我的代码
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""></script>
</html>
";
string adsenseFile1 = Environment.CurrentDirectory + "\\adsense1.html";
using (StreamWriter writer = new StreamWriter(adsenseFile1))
writer.Write(HTML);
webBrowser1.Navigate(adsenseFile1);