c# - asp.net 4.0 "Page Not Found" error occured while Uploading File -
i'm unable resolve error page not found while uploading file sized > 1kb.
the sample code used
<input id="uploadexcel" type="file" size="48" name="uploadexcel1" class="browser" runat="server" /> <asp:button id="btnupload" runat="server" text="upload" cssclass="savebutton" onclick="btnupload_click" /> protected void btnupload_click(object sender, eventargs e) { // page not found occurred. }
web.config settings
<httpruntime executiontimeout="3600" maxrequestlength="1048576" usefullyqualifiedredirecturl="false" minfreethreads="8" minlocalrequestfreethreads="4" apprequestqueuelimit="100" /> <system.webserver> <security> <requestfiltering> <requestlimits maxallowedcontentlength="50000000" /> </requestfiltering> </security>
the error occurred when page postback event defined on upload button i.e "btnupload_click". i've tried same removing click event on upload button still same error. i'm wondering, in upload button event not code specified uploading file or saving file,then why such error?
i'm thinking might me server related setting make work.since same working in localhost environment.
any idea of server iis level setting ?
i try code on solution.
web.config file :
<configuration> <system.web> <compilation debug="true" targetframework="4.0" /> <httpruntime executiontimeout="3600" maxrequestlength="1048576" /> </system.web> <system.webserver> <security> <requestfiltering> <requestlimits maxallowedcontentlength="2147483648" /> </requestfiltering> </security> </system.webserver> </configuration>
aspx.cs code:
protected void btnupload_click(object sender, eventargs e) { httppostedfile file = uploadexcel.postedfile; }
aspx code :
<form id="form1" runat="server" > <div> <input id="uploadexcel" type="file" size="48" name="uploadexcel1" class="browser" runat="server" /> <asp:button id="btnupload" runat="server" text="upload" cssclass="savebutton" onclick="btnupload_click" /> </div> </form>
please check web.config code httpruntime tag out <system.web>
tag. code working perfectly. (try 550 mb files)
please check file succesfull working , file-size, , check iis mÄ°me/type list.
Comments
Post a Comment