gogetsome
asked on
Maximum request length exceeded
Hello, I have a simple gridview that I want to allow editing with. Very simple really. The data populates correctly, But when you click on the edit button you get the error below. What could be causing this? I've ton of these and have never seen this error.
Exception Details: System.Web.HttpException: Maximum request length exceeded.
Stack Trace:
[HttpException (0x80004005): Maximum request length exceeded.]
System.Web.HttpRequest.Get EntireRawC ontent() +293
System.Web.HttpRequest.Fil lInFormCol lection() +173
System.Web.HttpRequest.get _Form() +64
System.Web.HttpRequest.get _HasForm() +79
System.Web.UI.Page.GetColl ectionBase dOnMethod( Boolean dontReturnNull) +63
System.Web.UI.Page.Determi nePostBack Mode() +134
System.Web.UI.Page.Process RequestMai n(Boolean includeStagesBeforeAsyncPo int, Boolean includeStagesAfterAsyncPoi nt) +251
Here is the code:
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False " DataKeyNames="CUSTNMBR"
DataSourceID="SqlDataSourc e1">
<Columns>
<asp:CommandField ShowEditButton="True" />
<asp:BoundField DataField="CUSTNMBR" HeaderText="CUSTNMBR" ReadOnly="True" SortExpression="CUSTNMBR" />
<asp:BoundField DataField="CUSTNAME" HeaderText="CUSTNAME" SortExpression="CUSTNAME" />
<asp:BoundField DataField="CUSTCLAS" HeaderText="CUSTCLAS" SortExpression="CUSTCLAS" />
</Columns>
</asp:GridView>
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:TESTConn ectionStri ng %>"
DeleteCommand="DELETE FROM [RM00101] WHERE [CUSTNMBR] = @CUSTNMBR" InsertCommand="INSERT INTO [RM00101] ([CUSTNMBR], [CUSTNAME], [CUSTCLAS]) VALUES (@CUSTNMBR, @CUSTNAME, @CUSTCLAS)"
SelectCommand="SELECT [CUSTNMBR], [CUSTNAME], [CUSTCLAS] FROM [RM00101] ORDER BY [CUSTCLAS], [CUSTNAME]"
UpdateCommand="UPDATE [RM00101] SET [CUSTNAME] = @CUSTNAME, [CUSTCLAS] = @CUSTCLAS WHERE [CUSTNMBR] = @CUSTNMBR">
<DeleteParameters>
<asp:Parameter Name="CUSTNMBR" Type="String" />
</DeleteParameters>
<UpdateParameters>
<asp:Parameter Name="CUSTNAME" Type="String" />
<asp:Parameter Name="CUSTCLAS" Type="String" />
<asp:Parameter Name="CUSTNMBR" Type="String" />
</UpdateParameters>
<InsertParameters>
<asp:Parameter Name="CUSTNMBR" Type="String" />
<asp:Parameter Name="CUSTNAME" Type="String" />
<asp:Parameter Name="CUSTCLAS" Type="String" />
</InsertParameters>
</asp:SqlDataSource>
Exception Details: System.Web.HttpException: Maximum request length exceeded.
Stack Trace:
[HttpException (0x80004005): Maximum request length exceeded.]
System.Web.HttpRequest.Get
System.Web.HttpRequest.Fil
System.Web.HttpRequest.get
System.Web.HttpRequest.get
System.Web.UI.Page.GetColl
System.Web.UI.Page.Determi
System.Web.UI.Page.Process
Here is the code:
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False
DataSourceID="SqlDataSourc
<Columns>
<asp:CommandField ShowEditButton="True" />
<asp:BoundField DataField="CUSTNMBR" HeaderText="CUSTNMBR" ReadOnly="True" SortExpression="CUSTNMBR" />
<asp:BoundField DataField="CUSTNAME" HeaderText="CUSTNAME" SortExpression="CUSTNAME" />
<asp:BoundField DataField="CUSTCLAS" HeaderText="CUSTCLAS" SortExpression="CUSTCLAS" />
</Columns>
</asp:GridView>
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:TESTConn
DeleteCommand="DELETE FROM [RM00101] WHERE [CUSTNMBR] = @CUSTNMBR" InsertCommand="INSERT INTO [RM00101] ([CUSTNMBR], [CUSTNAME], [CUSTCLAS]) VALUES (@CUSTNMBR, @CUSTNAME, @CUSTCLAS)"
SelectCommand="SELECT [CUSTNMBR], [CUSTNAME], [CUSTCLAS] FROM [RM00101] ORDER BY [CUSTCLAS], [CUSTNAME]"
UpdateCommand="UPDATE [RM00101] SET [CUSTNAME] = @CUSTNAME, [CUSTCLAS] = @CUSTCLAS WHERE [CUSTNMBR] = @CUSTNMBR">
<DeleteParameters>
<asp:Parameter Name="CUSTNMBR" Type="String" />
</DeleteParameters>
<UpdateParameters>
<asp:Parameter Name="CUSTNAME" Type="String" />
<asp:Parameter Name="CUSTCLAS" Type="String" />
<asp:Parameter Name="CUSTNMBR" Type="String" />
</UpdateParameters>
<InsertParameters>
<asp:Parameter Name="CUSTNMBR" Type="String" />
<asp:Parameter Name="CUSTNAME" Type="String" />
<asp:Parameter Name="CUSTCLAS" Type="String" />
</InsertParameters>
</asp:SqlDataSource>
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
How big is your viewstate? Is that causing it? Use something like Fiddler or ieHttpHeaders to inspect the length of the request you are sending, as jjardine says, it is likely that it is over the limit ASP.NET allows, or the web server is restricted to.
Andy
Andy
ASKER
jjardine thanks for the info. Adding <httpRuntime maxRequestLength="8192" /> to the web.config as stated in the article fixed the issue.
I hope your network is fast if your pages are that big ;-)
-Nauman.