asp.net – 可能导致XML解析错误:没有找到元素?
我最近将ASP网站从我的开发机器迁移到实时服务器.除了我的常见问题页面之外的所有页面都可以正常工作,但是我的常见问题解答提出:
XML Parsing Error: no element found Location: http://geniusupdate.com/GSHelp/faq.aspx Line Number 1,Column 1: 我所做的唯一变化是将我的SQL页面上的连接字符串从本地更改为我的主机服务器指定的字符串.任何提示我可以做什么来找出这个问题的根源? 这里是我的常见问题页面的来源: <%@ Page Language="VB" MasterPageFile="~/theMaster.master" AutoEventWireup="false" CodeFile="faq.aspx.vb" Inherits="faq" Title="Untitled Page" %> <%@ Import Namespace="sqlstuff" %> <%@ Import Namespace="functions" %> <asp:Content ContentPlaceHolderID="page_title" ID="theTitle" runat="server"> FAQ</asp:Content> <asp:Content ContentPlaceHolderID="column1_title" ID="col1Title" runat="server"> <%=faqPageTitle(Request.QueryString("cid"))%></asp:Content> <asp:Content ContentPlaceHolderID="column1" ID="columnContent" runat="server"> <p>Click on a question to expand it to see the answer!</p> <p><% If cID >= 0 Then Dim theFaq As New List(Of faqContent),iterate As Integer = 0 theFaq = sqlStuff.getFaqs(cID) For Each oFaq As faqContent In theFaq Response.Output.WriteLine("<h4 id={0} class={1}>Q: {2}</h4>",_ addQuotes("gsSwitch{0}-title",iterate),_ addQuotes("handCursor"),_ oFaq.Content.Question) Response.Output.WriteLine("<div id={0} class={1}><string>A: </strong>{2}</div>",_ addQuotes("gsSwitch{0}",_ addQuotes("gsSwitch"),_ oFaq.Content.Answer) iterate += 1 Next Else Response.Output.Write("Here you can find a lot of information about eTHOMAS and how to expedite your office tasks.{0}",ControlChars.NewLine) End If %></p> <script type="text/javascript"> var gsContent = new switchcontent("gsSwitch","div") var eID = '<%= expandID %>' gsContent.collapsePrevious(true) // TRUE: only 1; FALSE: any number gsContent.setPersist(false) if(eID >= 0){ gsContent.defaultExpanded(eID) // opens the searched FAQ document.getElementById('gsSwitch' + eID + '-title').scrollIntoView(true) // scrolls to selected FAQ } gsContent.init() </script> </asp:Content> <asp:Content ContentPlaceHolderID="subcolumn_right_title" ID="rSideColTitle" runat="server"></asp:Content> <asp:Content ContentPlaceHolderID="subcolumn_right" ID="rSideColContent" runat="server"></asp:Content> <asp:Content ContentPlaceHolderID="subcolumn_left_title" ID="lSideColTitle" runat="server"></asp:Content> <asp:Content ContentPlaceHolderID="subcolumn_left" ID="lSideColContent" runat="server"></asp:Content> <asp:Content ContentPlaceHolderID="sidecolumn_title" ID="sideColtitle" runat="server"> </asp:Content> <asp:Content ContentPlaceHolderID="sidecolumn" ID="sideCol" runat="server"> <% If cID >= 0 Then Response.Write(constructFaqSideMenu(CInt(Request.QueryString("cid")))) Else Response.Write(constructFaqSideMenu()) End If %> </asp:Content> 我在另一个论坛上发现了这个link:
IE不渲染页面,期间.这就是XML来自的地方. 这里是constructFaqSideMenu()函数: Public Shared Function constructFaqSideMenu(ByVal oSelID As Integer) As String Dim oCatList As New List(Of faqCategory) Dim oRet As New StringBuilder Dim iterate As Integer = 1,extraTag As String = "" oCatList = sqlStuff.getFaqCats oRet.AppendFormattedLine("<ul id={0}>",addQuotes("submenu")) oRet.AppendFormattedLine(" <li id={0}>FAQ Categories</li>",addQuotes("title")) For Each category As faqCategory In oCatList If iterate = oSelID Then extraTag = String.Format(" id={0}",addQuotes("active")) Else extraTag = "" End If oRet.AppendFormattedLine(" <li{0}><a href={1}>{2}</a></li>",extraTag,addQuotes("faq.aspx?cid={0}",StrConv(category.Title,VbStrConv.ProperCase)) iterate += 1 Next oRet.AppendLine("</ul>") Return oRet.ToString End Function 而这里是空白页的来源IE返回: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML><HEAD> <META http-equiv=Content-Type content="text/html; charset=windows-1252"></HEAD> <BODY></BODY></HTML> 解决方法
这是一个非常老的线程,但是我发现这是同样的问题,而想要为将来搜索这个的任何人提供一个确定的答案.
当页面指令被解析时抛出异常时,我收到此错误.我从源代码控制更新了aspx文件,检查它们的开发人员有不同版本的第三方控件库.注册组件页面指令引用了我没有的版本,因此在此时抛出了异常.我假设在客户端中出现异常时,如果在页面请求生命周期中尽早抛出异常,那么根本就不会向客户端发送异常. 我们正在Global.Application_Error中的应用程序级别记录所有异常,因此我可以从日志中获取此信息.我们使用以下代码获取最后一个异常: Server.GetLastError().GetBaseException() (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
- asp.net-mvc-3 – EntityFramework类的AllowHtml属性
- asp.net-mvc-4 – URL.Action参数中的客户端值
- 小白开学Asp.Net Core《二》
- asp.net-mvc-4 – 在asp .net mvc 4中使用htmlhelper创建te
- asp.net-core-mvc – EF7和GroupBy()无法翻译
- asp.net-mvc – 为什么IIS / ASP.Net / MVC3将max-age设置为
- asp.net – 这个LINQ statment是否容易受SQL注入攻击?
- asp.net-mvc – 在自定义Html帮助器中访问模型对象
- 【ABP.Net】1.创建项目&介绍框架结构
- datetime – 将时间转换为UTC vbScript
- ASP.NET jQuery错误:未知的Web方法
- 如何使用ASP.NET更改HTML页面元素的CSS类?
- .NET Core采用的全新配置系统[3]: “Options模式
- 在ASP和ASP.Net之间共享登录系统
- asp.net – 动态CheckBoxFor有一些禁用
- query-string – asp .net 2.0上的最大查询字符串
- asp.net-mvc – ASP.NET MVC 4 – 301重定向Rout
- Razor Page Library:开发独立通用RPL(内嵌wwwr
- 转:[WebServices]介绍
- asp.net-mvc-3 – 从JsonResult MVC3 / Razor中动