Hello guys,
I have a form in which students need to upload files, but when performing the process it is giving the error:
Maximum request size exceeded.
The same happens when I try to download the file (DataGrid1_ItemCommand)
Below is the html and VB code.
HTML:
<%@ Page Title="" Language="VB" MasterPageFile="~/candidato/MasterPage.master" AutoEventWireup="false" CodeFile="cadMeusDadosAnexos.aspx.vb" Inherits="candidato_cadMeusDadosAnexos" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<style>
.imgDoc {
max-height:100px;
max-width: 100px;
}
</style>
<ajaxToolkit:ModalPopupExtender ID="mpeAlerta" runat="server" PopupControlID="panAlerta" TargetControlID="BtnAlertaOculto" CancelControlID="BtnCancelaAlerta" BackgroundCssClass="fundo-fosco" DropShadow="true">
</ajaxToolkit:ModalPopupExtender>
<div style="display:none;">
<asp:Button ID="BtnAlertaOculto" runat="server" Text="Abre alerta" />
</div>
<div>
<asp:Panel ID="panAlerta" runat="server" CssClass="alert alert-danger" style="padding:10px !important; max-width:300px !important; display:none;" >
<div class="h3">ATENÇÃO!</div>
<hr />
<div>Por favor, preencha o(s) campo(s) em destaque.</div>
<hr />
<div>
<asp:Button ID="BtnCancelaAlerta" runat="server" CssClass="btn btn-danger" Text="OK" />
</div>
</asp:Panel>
</div>
<div class="form-group">
<div class="row">
<div class="col-sm-12">
<div><h3>Anexos</h3></div>
</div>
</div>
<div class="row">
<div class="col-sm-12">
<div><asp:HiddenField ID="hfID" runat="server" /></div>
<div><asp:HiddenField ID="hfValida" runat="server" /></div>
<div class="alert alert-info">
<asp:Label ID="LbPessoa" runat="server" Text="LbPessoa" ></asp:Label>
</div>
<div style="padding:10px 0px 10px 0px;">
Anexe apenas arquivos com extensões .pdf, .jpg ou .jpeg.</div>
<div style="padding:5px;">
<div>
<asp:DataGrid ID="DataGrid1" runat="server" AutoGenerateColumns="False" CssClass="btsGrid">
<AlternatingItemStyle CssClass="btsGrid-alternate" />
<Columns>
<asp:BoundColumn DataField="ID" HeaderText="ID"></asp:BoundColumn>
<asp:TemplateColumn HeaderText="TIPO DE DOCUMENTO">
<ItemTemplate>
<div style="padding:10px 0px 10px 0px;">
<asp:Panel ID="gpanCampos" runat="server" CssClass="panel-control-transparent" >
<div><asp:Label ID="gLbNomeTipoDoc" runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.NOME") %>'></asp:Label></div>
<div><asp:FileUpload ID="gFileUpload1" runat="server" CssClass="form-control" Visible='<%# DataBinder.Eval(Container, "DataItem.VERUPLOAD") %>' /></div>
<div><asp:Label ID="gLbNomeArquivo" runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.ARQUIVO") %>'></asp:Label></div>
<div><asp:Label ID="gLbCaminhoArquivo" runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.CAMINHODOARQUIVO") %>' Visible="False" ></asp:Label></div>
<div><asp:Label ID="gLbMensagemAnexos" runat="server" ></asp:Label></div>
<div><asp:HiddenField ID="gHfID" runat="server" Value='<%# DataBinder.Eval(Container, "DataItem.ID") %>' /></div>
<div><asp:HiddenField ID="ghfIDImagem" runat="server" Value='<%# DataBinder.Eval(Container, "DataItem.IDIMAGEM") %>' /></div>
<div><asp:HiddenField ID="ghfObrigatorio" runat="server" Value='<%# DataBinder.Eval(Container, "DataItem.OBRIGATORIO") %>' /></div>
<div><asp:HiddenField ID="ghfTestaImagem" runat="server" Value='<%# DataBinder.Eval(Container, "DataItem.TESTAIMAGEM") %>' /></div>
</asp:Panel>
</div>
</ItemTemplate>
</asp:TemplateColumn>
<asp:TemplateColumn HeaderText="IMAGEM BANCO">
<ItemTemplate>
<div style="padding:10px 0px 10px 0px;">
<asp:Image ID="gImage" runat="server" CssClass="imgDoc" />
<asp:ImageButton ID="gBtnVerImg" runat="server" CommandName='<%# "verImagem" %>' ImageUrl="~/imagens/BtnConsulta.png" />
</div>
</ItemTemplate>
<HeaderStyle Font-Bold="False" Font-Italic="False" Font-Overline="False" Font-Strikeout="False" Font-Underline="False" HorizontalAlign="Center" />
<ItemStyle Font-Bold="False" Font-Italic="False" Font-Overline="False" Font-Strikeout="False" Font-Underline="False" HorizontalAlign="Center" />
</asp:TemplateColumn>
<asp:TemplateColumn>
<ItemTemplate>
<div style="padding:10px 0px 10px 0px;"><asp:CheckBox ID="gCbDelete" runat="server" Visible='<%# DataBinder.Eval(Container, "DataItem.VERIMGDOC") %>' /></div>
</ItemTemplate>
<HeaderStyle Font-Bold="False" Font-Italic="False" Font-Overline="False" Font-Strikeout="False" Font-Underline="False" HorizontalAlign="Center" />
<ItemStyle Font-Bold="False" Font-Italic="False" Font-Overline="False" Font-Strikeout="False" Font-Underline="False" HorizontalAlign="Center" />
</asp:TemplateColumn>
</Columns>
<HeaderStyle CssClass="btsGrid-header" />
</asp:DataGrid>
</div>
<div style="margin-top:10px; text-align:center;">
<asp:Button ID="BtnEnviar" runat="server" CssClass="btn btn-success" style="margin-right:5px;" Text="Enviar" />
<asp:Button ID="BtnExcluir" runat="server" CssClass="btn btn-danger" style="margin-right:5px;" Text="Excluir" />
<asp:Button ID="BtnContinue" runat="server" CssClass="btn btn-info" Text="Continue" />
</div>
<div></div>
</div>
</div>
</div>
</div>
</asp:Content>
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<section name="ajaxControlToolkit" type="AjaxControlToolkit.AjaxControlToolkitConfigSection, AjaxControlToolkit" />
</configSections>
<appSettings>
<add key="cStrConexao" value="server=DB1;uid=sa;pwd=123456;database=cvtweb_teste" />
</appSettings>
<connectionStrings>
<add name="cStrConexao2" connectionString="Data Source=DB1;Initial Catalog=cvtweb_teste;User ID=sa;Password=123456" providerName="System.Data.SqlClient" />
</connectionStrings>
<!--
PERMISSAO DOS BOLETOS **************************************************************
<location path="Selecoes/CANDIDATOS/RELATORIOS/BOLETOS">
<system.web>
<authorization>
<allow users="*"/>
</authorization>
</system.web>
</location>
FIM DA PERMISSAO DOS BOLETOS *******************************************************
-->
<system.web>
<pages validateRequest="false">
<controls>
<add tagPrefix="asp" namespace="System.Web.UI.DataVisualization.Charting" assembly="System.Web.DataVisualization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
<add tagPrefix="ajaxToolkit" assembly="AjaxControlToolkit" namespace="AjaxControlToolkit" />
</controls>
</pages>
<httpHandlers>
<add path="Reserved.ReportViewerWebControl.axd" verb="*" type="Microsoft.Reporting.WebForms.HttpHandler, Microsoft.ReportViewer.WebForms, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" validate="false" />
<add path="ChartImg.axd" verb="GET,HEAD,POST" type="System.Web.UI.DataVisualization.Charting.ChartHttpHandler, System.Web.DataVisualization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" validate="false" />
</httpHandlers>
<compilation debug="true" targetFramework="4.6">
<assemblies>
<add assembly="System.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A" />
<add assembly="System.Web.Extensions.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<add assembly="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" />
<add assembly="Microsoft.Build.Framework, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A" />
<add assembly="System.Management, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A" />
<add assembly="System.Windows.Forms.DataVisualization, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<add assembly="Microsoft.ReportViewer.WebForms, Version=10.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A" />
<add assembly="Microsoft.ReportViewer.Common, Version=10.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A" />
<add assembly="ADODB, Version=7.0.3300.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A" />
<add assembly="MySql.Data, Version=5.0.9.0, Culture=neutral, PublicKeyToken=C5687FC88969C44D" />
<add assembly="System.Web.DataVisualization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" /></assemblies>
<buildProviders>
<add extension=".rdlc" type="Microsoft.Reporting.RdlBuildProvider, Microsoft.ReportViewer.WebForms, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
</buildProviders>
</compilation>
<!-- <globalization requestEncoding="iso-8859-1" responseEncoding="iso-8859-1" /> -->
<httpRuntime requestValidationMode="2.0" />
<!-- Esta linha foi inserida para corrigir erros no Editor FreeTextBox -->
<globalization culture="pt-BR" uiCulture="pt-BR" requestEncoding="iso-8859-1" responseEncoding="iso-8859-1" fileEncoding="iso-8859-1" />
<customErrors mode="Off" defaultRedirect="mens_erro.aspx">
<error statusCode="403" redirect="NoAccess.htm" />
<error statusCode="404" redirect="FileNotFound.htm" />
</customErrors>
<!--
<customErrors mode="On">
<error statusCode="400" redirect="Erro.aspx?ID=400"/>
<error statusCode="401" redirect="Erro.aspx?ID=401"/>
<error statusCode="403" redirect="Erro.aspx?ID=403"/>
<error statusCode="404" redirect="Erro.aspx?ID=404"/>
<error statusCode="405" redirect="Erro.aspx?ID=405"/>
<error statusCode="406" redirect="Erro.aspx?ID=406"/>
<error statusCode="407" redirect="Erro.aspx?ID=407"/>
<error statusCode="408" redirect="Erro.aspx?ID=408"/>
<error statusCode="409" redirect="Erro.aspx?ID=409"/>
<error statusCode="410" redirect="Erro.aspx?ID=410"/>
<error statusCode="440" redirect="Erro.aspx?ID=440"/>
<error statusCode="500" redirect="Erro.aspx?ID=500"/>
<error statusCode="501" redirect="Erro.aspx?ID=501"/>
<error statusCode="502" redirect="Erro.aspx?ID=502"/>
<error statusCode="503" redirect="Erro.aspx?ID=503"/>
<error statusCode="508" redirect="Erro.aspx?ID=508"/>
</customErrors>
-->
<authentication mode="Forms">
<forms timeout="50000000" />
</authentication>
<!-- <httpRuntime requestValidationMode="2.0" /> -->
</system.web>
<location path="UploadPage.aspx">
<system.web>
<httpRuntime executionTimeout="3600" maxRequestLength="10240" appRequestQueueLimit="100" />
</system.web>
</location>
<system.web.extensions>
<scripting>
<scriptResourceHandler enableCompression="true" enableCaching="true" />
</scripting>
</system.web.extensions>
<system.webServer>
<validation validateIntegratedModeConfiguration="false" />
<modules>
<add name="ScriptModule" preCondition="integratedMode" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
</modules>
<handlers>
<remove name="WebServiceHandlerFactory-Integrated" />
<remove name="ChartImageHandler" />
<add name="ScriptHandlerFactory" verb="*" path="*.asmx" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
<add name="ScriptHandlerFactoryAppServices" verb="*" path="*_AppService.axd" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
<add name="ScriptResource" preCondition="integratedMode" verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
<add name="ReportViewerWebControlHandler" preCondition="integratedMode" verb="*" path="Reserved.ReportViewerWebControl.axd" type="Microsoft.Reporting.WebForms.HttpHandler, Microsoft.ReportViewer.WebForms, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<add name="ChartImageHandler" preCondition="integratedMode" verb="GET,HEAD,POST" path="ChartImg.axd" type="System.Web.UI.DataVisualization.Charting.ChartHttpHandler, System.Web.DataVisualization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
</handlers>
<httpRedirect enabled="false" destination="http://www.centec.org.br" />
<defaultDocument>
<files>
<clear />
<add value="Index.aspx" />
<add value="iisstart.htm" />
<add value="Default.htm" />
<add value="Default.asp" />
<add value="index.htm" />
<add value="index.html" />
<add value="default.aspx" />
</files>
</defaultDocument>
</system.webServer>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="AjaxControlToolkit" publicKeyToken="28f01b0e84b6d53e" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.1.60919.0" newVersion="4.1.60919.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
Grateful,
Ilano.