本文介绍了我在服务器上上传网站时代码错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我在本地系统上运行网站时,它运行完美.但是,当我在服务器上上传内容时,在某些页面上我们使用microsoft.mshtml.dll进行html解析时出现了错误.请帮助我解决我的问题.
创建错误的代码是:

when i run my website on local system then it work perfect. but when i upload content on server then i got error on some page where we use microsoft.mshtml.dll for html parsing. please help me to solve my problem.
Code That create error is :

<br />
string STR = "";<br />
        public string GetPlan(string html)<br />
        {<br />
            HTMLDocument htmlDoc = new HTMLDocument();<br />
            IHTMLDocument2 iHtmlDoc2 = null;<br />
            iHtmlDoc2 = (IHTMLDocument2)htmlDoc;  <br />
            iHtmlDoc2.designMode = "On";<br />
            iHtmlDoc2.write(html);  <br />
            iHtmlDoc2.close();<br />
            foreach (IHTMLElement htmlElem in (IHTMLElementCollection)iHtmlDoc2.body.all)<br />
            {<br />
                if (htmlElem is HTMLTable)<br />
                {<br />
                    HTMLTable table = htmlElem as HTMLTable;<br />
                    if (table != null && table.width.ToString() == "575")<br />
                        STR += table.innerHTML + "<BR/>";<br />
                    Console.WriteLine("Form element found: " + table.innerHTML);<br />
                }<br />
            }<br />
            return "g";<br />
        }<br />
       public string  getstring(string path)<br />
        {<br />
            WebRequest req = WebRequest.Create(path);<br />
            WebResponse res = req.GetResponse();<br />
            StreamReader sr = new StreamReader(res.GetResponseStream());<br />
            string html = sr.ReadToEnd();    <br />
            GetPlan(html);<br />
            return STR;<br />
        }<br />
<br />

推荐答案



这篇关于我在服务器上上传网站时代码错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-14 20:53