在web.config中加入httpRuntime元素,如下:
<configuration>
<system.web>
<httpRuntime maxRequestLength="8192"
useFullyQualifiedRedirectUrl="true"
executionTimeout="45"
versionHeader="1.1.4128"/>
</system.web>
</configuration>
其中maxRequestLength屬性就是限制上傳大小的,如設為"8192"即為8M。