WebBrowser控件显示标记而不是页面

时间:2009-08-24 19:45:27

标签: asp.net xml

所有

我有一个.NET(C#)WebBrowser控件,它通过XSL/XML从数据库调用中填充。在我的电脑上,此控件按预期显示页面,但是当安装在另一台PC上时,它只显示标记。
为什么会出现这种情况有什么想法?
这将安装给域用户使用,这可能是一个安全问题吗?同样,这个用户使用的是Windows 2000,我相信。

如果它有用,我已经添加了完成工作的代码。

kioskID = Convert.ToInt16(cboKiosks.SelectedValue); string kioskName = cboKiosks.SelectedText; try { using (Database d = new Database()) { // Create the database objects. d.Command.CommandText = reportName; d.Command.Parameters.Add("@Start", SqlDbType.DateTime).Value = dtpStartDate.Value; d.Command.Parameters.Add("@Stop", SqlDbType.DateTime).Value = dtpStopDate.Value; if (kioskID == -1) d.Command.Parameters.Add("@KioskID", SqlDbType.Int).Value = System.DBNull.Value; else d.Command.Parameters.Add("@KioskID", SqlDbType.Int).Value = kioskID;

                    if (kioskSite == "**ALL SITES**")
                        d.Command.Parameters.Add("@Site", SqlDbType.VarChar).Value = System.DBNull.Value;
                    else
                        d.Command.Parameters.Add("@Site", SqlDbType.VarChar).Value = kioskSite;

                    // Load the XML.
                    d.Connection.Open();
                    XPathDocument xp = new XPathDocument(d.Command.ExecuteXmlReader());
                    d.Connection.Close();

                    System.Uri u = new Uri(Application.StartupPath);
                    string folder = u.ToString();

                    // Transform the XML to a CSV-formatted string.
                    StringWriter sw = new StringWriter();
                    XsltArgumentList xa = new XsltArgumentList();                        
                    xa.AddParam("When", "", System.DateTime.Now.ToLongDateString() + " at " + System.DateTime.Now.ToShortTimeString());
                    xa.AddParam("ImageFolder", "", folder);
                    XslCompiledTransform xt = new XslCompiledTransform();
                    xt.Load(templateName);
                    xt.Transform(xp, xa, sw);

                    webBrowser.DocumentText = sw.ToString();

if (kioskSite == "**ALL SITES**") d.Command.Parameters.Add("@Site", SqlDbType.VarChar).Value = System.DBNull.Value; else d.Command.Parameters.Add("@Site", SqlDbType.VarChar).Value = kioskSite; // Load the XML. d.Connection.Open(); XPathDocument xp = new XPathDocument(d.Command.ExecuteXmlReader()); d.Connection.Close(); System.Uri u = new Uri(Application.StartupPath); string folder = u.ToString(); // Transform the XML to a CSV-formatted string. StringWriter sw = new StringWriter(); XsltArgumentList xa = new XsltArgumentList(); xa.AddParam("When", "", System.DateTime.Now.ToLongDateString() + " at " + System.DateTime.Now.ToShortTimeString()); xa.AddParam("ImageFolder", "", folder); XslCompiledTransform xt = new XslCompiledTransform(); xt.Load(templateName); xt.Transform(xp, xa, sw); webBrowser.DocumentText = sw.ToString();

0 个答案:

没有答案