在网页c#代码中显示长HTML文本

在网页c#代码中显示长HTML文本,c#,C#,我正在使用C#net 我有一个网页,这个网页有一个“报告ID”的列表视图 当用户单击列表框中的报告id时,请求的功能是报告文本应显示在div中 报告文本为HTML格式(相当长,约16000000字符) 当我单击列表框中的报告ID时 我得到这个错误 我补充说 <system.webServer> <security> <requestFiltering> <requestLimits

我正在使用C#net

我有一个网页,这个网页有一个“报告ID”的列表视图

当用户单击列表框中的报告id时,请求的功能是报告文本应显示在div中

报告文本为HTML格式(相当长,约16000000字符)

当我单击列表框中的报告ID时

我得到这个错误

我补充说

<system.webServer>
        <security>
            <requestFiltering>
                <requestLimits maxAllowedContentLength="1073741824" />
            </requestFiltering>
        </security>
</system.webServer>

但仍然会出现同样的错误

如何解决这个问题?

我找到了答案

在system.web中

<httpRuntime maxRequestLength="1048576" executionTimeout="3600" />

和在system.webServer中

<security>
    <requestFiltering>
        <requestLimits maxAllowedContentLength="1073741824" />
    </requestFiltering>
</security>

这可能会对您有所帮助

<configuration>
  <system.web>
    <httpRuntime targetFramework="4.5.2" maxRequestLength="1048576"/>
  </system.web>
</configuration>

<system.webServer>
  <security>
    <requestFiltering>
      <requestLimits maxAllowedContentLength="1073741824" />
    </requestFiltering>
  </security>
</system.webServer>

规则:

  • maxRequestLength(以kb表示)值必须匹配 maxAllowedContentLength(以字节表示)
  • 大多数情况下,system.web部分可能已经包含 “httpRuntime”。将targetFramework设置为.net版本 用过
注:

  • maxRequestLength的默认值为4096(4mb)。最大值为 2147483647
  • maxAllowedContentLength的默认值为30000000(大约 30mb)。最大值为4294967295

这是否回答了您的问题@格斯伯格:是的,我是从那里得到答案的