This question already has an answer here:
这个问题在这里已有答案:
- Asp.Net MVC: requests with too long URLs and error handling 1 answer
- Asp.Net MVC:请求URL过长和错误处理1个答案
Hi Im developing a web application its working fine but yesterday i had a problem when i click a link it gives error
嗨我正在开发一个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
when i see the url it gives
当我看到它给出的网址时
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=%2FwEPDwUJNDYyMTAzODEzD2QWAmYPZBYCAgMPFgIeBVN0eWxlBRZiYWNrZ3JvdW5kLWNvbG9yOmdyYXk7FgICAQ9kFgICBQ9kFgICAQ9kFgJmD2QWCAIBD2QWAgICD2QWAgIFDxYCHgVjbGFzcwUGYWN0aXZlZAIHDxYCHgtfIUl0ZW1Db3VudAIHFg5mD2QWAgIBDw8WBB4PQ29tbWFuZEFyZ3VtZW50BQIxNR4EVGV4dAUYTWFsYTNpYm5hIFByZW1pZXIgTGVhZ3VlZGQCAQ9kFgICAQ8PFgQfAwUCMjcfBAUTTWFsYTNpYm5hIExlYWd1ZSBJSWRkAgIPZBYCAgEPDxYEHwMFAjMyHwQFEFphaW4gT3BlbiBMZWFndWVkZAIDD2QWAgIBDw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2FCA6isfdeVZNI7ASIt6PIaNSDwYlmNi0mpPi0I865O2LxAkzBhdFYaprmaiJymxLDcxE8lkCGq8O%2FK9O%2Bxvyvd6m1rEnMKWo8zEV33E9GFKXkFjcWaCqaAgW2qiov5SRArqihOrSxEYbyJa3g5qQ2Jam7H6jdg0mtjuPgJaWULMB%2FbpCAdf7ktVQXjmrf1y9oq2oWS9acNO9Yc1W5i938A6IkJSOiBwkBn1OwaXcQXjo9pmSp7Z9xBfTzCWOjndtxqVe7P1g60B6H8GaVHt8JQ0P9q28BwvC9cHdFGTamhPR6aaQPzluOZwy2nH0kxwu%2FoUc0j2Hci7AEQbcGPc9OqBo573zFB6oeD6YmSEm3FzZAMGiuKPtJYMLpVWASUEThx6G7J4u8p1gB6XIwUD8ik6AU4%3D**
Im not giving any querystring, the code where error occurs is
我没有给出任何查询字符串,发生错误的代码是
<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 code
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);
}
}
as you can see i m not giving any querystring and how i prevent the querystring to autogenerate
im using asp dotnet4 Ajaxcontroltoolkit and using updatepanel. Any suggestions?????
你可以看到我没有提供任何查询字符串以及我如何阻止查询字符串使用asp dotnet4 Ajaxcontroltoolkit和使用updatepanel自动生成im。有什么建议么?????
<asp:UpdatePanel ID="AjaxPanel" UpdateMode="Conditional" ChildrenAsTriggers="true"
runat="server">
2 个解决方案
#1
1
The query string you are passing in the url is longer than 2048 which is the default value for maxQueryStringLength. You have to set a bigger value in the Web.config file (maxQueryStringLength) for example : "<httpRuntime maxQueryStringLength="16384" />"
Here's a link for more info
您在url中传递的查询字符串长于2048,这是maxQueryStringLength的默认值。您必须在Web.config文件(maxQueryStringLength)中设置更大的值,例如:“
#2
0
After fighting for one whole day i randomly found a solution I changed
战斗了一整天后,我随机找到了一个改变了的解决方案
<form id="form1" method="GET" runat="server">
to
至
<form id="form1" runat="server"> <!--(this solved my problem.) -->
I dont know why method="Get" generate long querystring (when i click any link in my page) which was giving error The length of the query string for this request exceeds the configured maxQueryStringLength value
我不知道为什么method =“Get”生成长查询字符串(当我点击我页面中的任何链接时)给出了错误此请求的查询字符串的长度超过了配置的maxQueryStringLength值
#1
1
The query string you are passing in the url is longer than 2048 which is the default value for maxQueryStringLength. You have to set a bigger value in the Web.config file (maxQueryStringLength) for example : "<httpRuntime maxQueryStringLength="16384" />"
Here's a link for more info
您在url中传递的查询字符串长于2048,这是maxQueryStringLength的默认值。您必须在Web.config文件(maxQueryStringLength)中设置更大的值,例如:“
#2
0
After fighting for one whole day i randomly found a solution I changed
战斗了一整天后,我随机找到了一个改变了的解决方案
<form id="form1" method="GET" runat="server">
to
至
<form id="form1" runat="server"> <!--(this solved my problem.) -->
I dont know why method="Get" generate long querystring (when i click any link in my page) which was giving error The length of the query string for this request exceeds the configured maxQueryStringLength value
我不知道为什么method =“Get”生成长查询字符串(当我点击我页面中的任何链接时)给出了错误此请求的查询字符串的长度超过了配置的maxQueryStringLength值