2

嗨,我正在开发一个 Web 应用程序,它工作正常,但昨天我点击一个链接时遇到问题,它给出了错误

 The length of the query string for this request exceeds the configured maxQueryStringLength value.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Web.HttpException: The length of the query string for this request exceeds the configured maxQueryStringLength value.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:


[HttpException (0x80004005): The length of the query string for this request exceeds the configured maxQueryStringLength value.]
   System.Web.HttpRequest.ValidateInputIfRequiredByConfig() +9672501
   System.Web.PipelineStepManager.ValidateHelper(HttpContext context) +53

当我看到它给出的网址时

http://www.mysitename.com/Teams/Gallery.aspx**?__EVENTTARGET=ctl00%24ContentPlaceHolder1%24rptWeeks%24ctl04%24lnk&__EVENTARGUMENT=&tbcGallery_ClientState={%22ActiveTabIndex%22%3A2%2C%22TabState%22%3A[true%2Ctrue%2Ctrue]}&__VIEWSTATE=%2FwEPDwUJNDYyMTAzODEzD2QWAmYPZBYCAgMPFgIeBVN0eWxlBRZiYWNrZ3JvdW5kLWNvbG9yOmdyYXk7FgICAQ9kFgICBQ9kFgICAQ9kFgJmD2QWCAIBD2QWAgICD2QWAgIFDxYCHgVjbGFzcwUGYWN0aXZlZAIHDxYCHgtfIUl0ZW1Db3VudAIHFg5mD2QWAgIBDw8WBB4PQ29tbWFuZEFyZ3VtZW50BQIxNR4EVGV4dAUYTWFsYTNpYm5hIFByZW1pZXIgTGVhZ3VlZGQCAQ9kFgICAQ8PFgQfAwUCMjcfBAUTTWFsYTNpYm5hIExlYWd1ZSBJSWRkAgIPZBYCAgEPDxYEHwMFAjMyHwQFEFphaW4gT3BlbiBMZWFndWVkZAIDD2QWAgIBDw8WBB8DBQI0Mh8EBRRaYWluIFVuZGVyIDE4IExlYWd1ZWRkAgQPZBYCAgEPDxYEHwMFAjQzHwQFE1phaW4gT3ZlciAzNSBMZWFndWVkZAIFD2QWAgIBD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aCqaAgW2qiov5SRArqihOrSxEYbyJa3g5qQ2Jam7H6jdg0mtjuPgJaWULMB%2FbpCAdf7ktVQXjmrf1y9oq2oWS9acNO9Yc1W5i938A6IkJSOiBwkBn1OwaXcQXjo9pmSp7Z9xBfTzCWOjndtxqVe7P1g60B6H8GaVHt8JQ0P9q28BwvC9cHdFGTamhPR6aaQPzluOZwy2nH0kxwu%2FoUc0j2Hci7AEQbcGPc9OqBo573zFB6oeD6YmSEm3FzZAMGiuKPtJYMLpVWASUEThx6G7J4u8p1gB6XIwUD8ik6AU4%3D**

我没有给出任何查询字符串,发生错误的代码是

<div class="row-fluid">
                        <div class="span4" style="margin-top: 40px;">
                            <div class="header">
                                <span style="padding-top: 10px; padding-left: 10px;">Leagues</span>
                            </div>
                            <div class="mainbody">
                                <asp:Repeater runat="server" ID="rptLeagues" ClientIDMode="Static" OnItemCommand="rptLeagues_ItemCommand">
                                    <ItemTemplate>
                                        <p>
                                            <asp:LinkButton ID="lnk" runat="server" CommandName="select" CommandArgument='<%# Eval("LeagueId") %>'
                                                Text='<%# Eval("LeagueName") %>'>  
                                            </asp:LinkButton><i class="pull-right" style="font-size: 15pt;">»</i></p>
                                    </ItemTemplate>
                                </asp:Repeater>
                            </div>
                        </div>
                        <div class="span4" style="margin-top: 40px;">
                            <div class="header">
                                <span style="padding-top: 10px; padding-left: 10px;">Stages</span>
                            </div>
                            <div class="mainbody">
                                <asp:Repeater runat="server" ID="rptStages" ClientIDMode="Static" OnItemCommand="rptStages_ItemCommand">
                                    <ItemTemplate>
                                        <p>
                                            <asp:LinkButton ID="lnk" runat="server" CommandName="select" CommandArgument='<%# Eval("LeagueId") %>'
                                                Text='<%# Eval("LeagueName") %>'>  
                                            </asp:LinkButton><i class="pull-right" style="font-size: 15pt;">»</i></p>
                                    </ItemTemplate>
                                </asp:Repeater>
                            </div>
                        </div>
                        <div class="span4" style="margin-top: 40px;">
                            <div class="header">
                                <span style="padding-top: 10px; padding-left: 10px;">Weeks</span>
                            </div>
                            <div class="mainbody">
                                <asp:Repeater runat="server" ID="rptWeeks" OnItemCommand="rptWeeks_ItemCommand">
                                    <ItemTemplate>
                                        <p>
                                            <asp:LinkButton ID="lnk" runat="server" CommandName="select" CommandArgument='<%# Eval("LeagueId") %>'
                                                Text='<%# Eval("LeagueName") %>'>  
                                            </asp:LinkButton><i class="pull-right" style="font-size: 15pt;">»</i></p>
                                    </ItemTemplate>
                                </asp:Repeater>
                            </div>
                        </div>
                    </div>

cs代码

protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            FillLeagues();
        }
    }
    protected void rptLeagues_ItemCommand(object source, RepeaterCommandEventArgs e)
    {
        try
        {
            if (e.CommandName == "select")
            {
                FillStages();
                rptWeeks.DataSource = null;
                rptWeeks.DataBind();
                tbcGallery.Visible = true;
            }
        }
        catch (Exception ex)
        {
            Messagebox.SetPopup("Error Found", ex.Message);
        }
    }
    protected void rptStages_ItemCommand(object source, RepeaterCommandEventArgs e)
    {
        try
        {
            if (e.CommandName == "select")
            {
                FillWeeks(e.CommandArgument.ToInt32());
                tbcGallery.Visible = true;

            }
        }
        catch (Exception ex)
        {
            Messagebox.SetPopup("Error Found", ex.Message);
        }
    }
    protected void rptWeeks_ItemCommand(object source, RepeaterCommandEventArgs e)
    {
        try
        {
            if (e.CommandName == "select")
            {
                //FillMatches(e.CommandArgument.ToInt32());
                tbcGallery.Visible = true;
                LoadVideos();
                LoadPictures();

            }
        }
        catch (Exception ex)
        {
            Messagebox.SetPopup("Error Found", ex.Message);
        }
    }

正如你所看到的,我没有给出任何查询字符串,以及我如何
使用 asp dotnet4 Ajaxcontroltoolkit 和使用 updatepanel 来防止查询字符串自动生成我。有什么建议么?????

<asp:UpdatePanel ID="AjaxPanel" UpdateMode="Conditional" ChildrenAsTriggers="true"
        runat="server">
4

2 回答 2

1

您在 url 中传递的查询字符串长于 2048,这是 maxQueryStringLength 的默认值。例如,您必须在 Web.config 文件 (maxQueryStringLength) 中设置一个更大的值:"<httpRuntime maxQueryStringLength="16384" />" 这是获取更多信息的链接

于 2015-04-22T10:27:44.290 回答
0

经过一整天的战斗,我随机找到了一个我改变的解决方案

 <form id="form1" method="GET" runat="server">    

<form id="form1"  runat="server"> <!--(this solved my problem.) -->

我不知道为什么 method="Get" 生成长查询字符串(当我单击页面中的任何链接时)这会给出错误此请求的查询字符串的长度超过配置的 maxQueryStringLength 值

于 2013-04-24T16:07:05.107 回答