【问题标题】:How to debug an aspx page, keeps saying page not found when there is an error如何调试aspx页面,出现错误时一直说找不到页面
【发布时间】:2015-11-20 09:28:50
【问题描述】:

我有一个带有列表视图的页面,但它有一些问题,但是当我运行它时,我没有收到错误,而是收到 404 资源未找到错误。如果我删除了有问题的列表视图并运行,那么它运行良好,所以它没有在页面等的正确位置寻找不是问题。 我怎样才能找出列表视图的错误,目前我没有得到任何有关它的信息,它甚至在设计视图中正确呈现。

非常感谢

有关信息,代码如下,但是我需要知道如何调试它,因为这已经发生过很多次了。

如果我删除此列表视图,页面将正常工作..

<asp:ListView ID="lvPerformanceKPIs" runat="server"
         OnItemDataBound="lvPerformanceKPIs_ItemDataBound" DataKeyNames="PerformanceMeasureID" 
        OnItemCommand="lvPerformanceKPIs_ItemCommand" ItemPlaceholderID="itemPlaceholder"
        >
        <LayoutTemplate>
            <table width="100%" border="0" cellpadding="2" cellspacing="0"> 
                <tr>
                    <th width="5%" class="Actions" >
                        Actions
                    </th>
                    <th width="2%" >&nbsp
                    </th>
                    <th width="5%">
                        ID
                    </th>
                    <th width="28%">
                        Group
                    </th>
                    <th width="40%">
                        Indicator
                    </th>
                    <th width="20%">
                        Threshold
                    </th>                        
                </tr>
            </table>
            <div runat="server" id="itemPlaceHolder">
            </div>
        </LayoutTemplate>
        <ItemTemplate>
            <div id="Div1" class="SUBDIV" runat="server">
                <table width="100%" border="0" cellpadding="2" cellspacing="0">
                    <tr>
                        <td width="5%" class="Actions">
                            <%--<img id="btnEdit" style="cursor: pointer;" alt="Edit" title="Edit this record" src="images/edit.png" width="15px" 
                                onclick="CRMEdit(this);"/>             

                            <asp:ImageButton ID="btnDelete" runat="server" title="Delete this record" src="images/delete.png" width="15px"
                                 OnclientClick="return confirm('Are you sure you want to delete this record?')" 
                                 CommandName="cmdDelete" CommandArgument=<%#Eval("PerformanceMeasureID") %>  />   --%>
                        </td>
                        <td width="2%">
                            <div class="btncolexp collapse" title="Expand to reveal/add files">
                                &nbsp;
                            </div>
                        </td>
                        <!-- id columns to get values then will be hidden with jquery -->
                        <td class="hidCol">
                            <span id="itemServiceSpecID"><%#Eval("ServiceSpecID")%></span>
                        </td>
                         <td class="hidCol">
                            <span id="itemPerfSortOrder"><%#Eval("PerfSortOrder")%></span>
                        </td>
                        <td class="hidCol">
                            <span id="itemPerfType"><%#Eval("PerfType")%></span>
                        </td>
                        <td class="hidCol">
                            <span id="itemPerfFrequency"><%#Eval("PerfFrequency")%></span>
                        </td>
                        <td width="5%">
                            <span id="itemPerformanceMeasureID"><%#Eval("PerformanceMeasureID")%></span>&nbsp
                        </td>
                        <td width="28%">
                            <span id="itemPerfGroup"><%#Eval("PerfGroup")%></span>&nbsp
                        </td>
                        <td width="40%">
                            <span id="itemPerfMeasure"><%#Eval("PerfMeasure")%></span>&nbsp
                        </td>
                        <td width="20%">
                            <span id="itemPerfThresholdText"><%#Eval("PerfThresholdText")%></span>&nbsp
                        </td>
                    </tr>          
                </table>
            </div>
        </ItemTemplate>
    </asp:ListView>      

【问题讨论】:

  • 出现错误时使用浏览器的F12
  • 这只是调试“'/'应用程序中的服务器错误”。页面。
  • 你能显示一些代码/更多信息
  • 我可以,但问题是我需要能够调试页面,因为这种情况在很多情况下都发生过,似乎当 aspx 页面出现问题时它只是没有编译(或其他)并且找不到。但没有迹象表明错误是什么。我将使用列表视图编辑问题...
  • 尝试找出问题的核心,以最小的形式 :) 尽可能小,删除行,删除标题.. 等等

标签: c# asp.net debugging webforms


【解决方案1】:

我想知道这些图像是否在项目模板中被正确注释掉。确保注释标签()和数据绑定标签之间没有冲突。

另外,CommandArgument 需要被引用:

CommandArgument='<%#Eval("PerformanceMeasureID") %>'

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-09-04
    • 2014-09-14
    • 2011-11-30
    • 2014-08-07
    相关资源
    最近更新 更多