I'm trying to increase maximum upload limit size in my .NET application... Current one is 4MB and I'd like to increase it to 25 MB ...
What I have tried so far (modifying web.config file):
<security>
<requestFiltering>
<!-- maxAllowedContentLength, for IIS, in bytes -->
<requestLimits maxAllowedContentLength="15728640" ></requestLimits>
</requestFiltering>
</security>
And:
<system.web>
<httpRuntime maxRequestLength="25000" />
</system.web>
The second method gives me following error:
HTTP Error 500.19 - Internal Server Error
The requested page cannot be accessed because the related configuration data for the page is invalid.
Without any of these method I'm getting this error:
Maximum request length exceeded.
I'm using .NET Web Forms... And my IIS version is 8 (or above I believe)...
Can someone help me out with this ?
string fileName = fileLanguage.PostedFile.FileName;
using (var fileStream = File.Create(Server.MapPath("../languages/") + fileName))
{
fileLanguage.PostedFile.InputStream.Seek(0, SeekOrigin.Begin);
fileLanguage.PostedFile.InputStream.CopyTo(fileStream);
}
Language language = new Language();
language.Name = txtLanguageName.Text;
language.Path = fileName;
ServiceClass.InsertLanguage(language);