一个页面上包括多个文本框,和dropdownlist,如果文本框中出现<br>时,选择dropdownlist就提示错误“sys.webforms.pagerequestmanagerservererrorexception:an unknown error occurred while processing the request on the server.the status code returned from the server was:500"请帮我看看怎样解决。

解决方案 »

  1.   

    aspx代码
      <tr>
                                            
                                                    <td bgcolor="#fffbf9" align="right">
                                                        <font color="red">*</font> 招聘岗位:
                                                    </td>
                                                    <td height="29" colspan="3" align="left" bgcolor="#fffbf9">
                                                  
                                                    <asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
        <asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">
                                                      <ContentTemplate>
                                                        <asp:DropDownList Style="z-index: 0" ID="dropCate" runat="server" OnSelectedIndexChanged="dropCate_SelectedIndexChanged" AutoPostBack="True">
                                                        </asp:DropDownList>
                                                        <asp:DropDownList Style="z-index: 0" ID="dropCate1" runat="server">
                                                        </asp:DropDownList>
                                                         </ContentTemplate>
                                                     </asp:UpdatePanel>
                                                    </td>         
                                        </tr> <tr>
                                            <td bgcolor="#fffbf9" align="right">
                                                具体要求:</td>
                                            <td bgcolor="#fffbf9" colspan="3" align="left">
                                                <textarea id="txtDemand" rows="4" cols="50" name="txtIntro" runat="server"></textarea>
                                            </td>
                                        </tr>当具体要求填入<br>时,选择dorpdownlist就出现错误。
      

  2.   

    带特殊符号时应该进行转义处理,比如用&lt; &gt;代替左右尖括号
      

  3.   

     public static string SQLReplace(string ParaValue)
        {
            ParaValue = ParaValue.Replace("+", "").Replace("-", "").Replace("=", "").Replace("%", "").Replace("<", "&gt;").Replace(">", "&lt;").Replace("<>", "").Replace("'", "").Replace("[", "").Replace("]", "").Replace("!", "").Replace("@", "").Replace("#", "").Replace(",", "").Replace(";", "");        return ParaValue;
        }
    替换掉
      

  4.   

     string strContent = this.txtDescribe.Value;
                strContent = strContent.Replace("<", "&gt;");
                strContent = strContent.Replace(">", "&lt;");
                strContent = strContent.Replace("\n", "<br>");
                strContent = strContent.Replace("  ", "&nbsp;&nbsp;");
                
                comm.Parameters.Add("@job_describe", strContent);我这样写,怎么仍然报错呢?好像还是没有转换过来?
      

  5.   

    strContent = strContent.Replace("\n", "<br>");
    颠倒了吧
      

  6.   

    <%@ Page EnableEventValidation="false"....>然后再用参考LS各位的