Sep 11, 2011

Get Max Request length from web.config

From msdn:
The MaxRequestLength property specifies the limit for the buffering threshold of the input stream. For example, this limit can be used to prevent denial of service attacks that are caused by users who post large files to the server.
For retrieving maxrequest length from web.config use following function:
public int GetMaxLength()
{
        HttpRuntimeSection httpRuntime =
(HttpRuntimeSection)ConfigurationManager.GetSection("system.web/httpRuntime");
        return httpRuntime.MaxRequestLength;
}
For retrieving maxrequest length from web.config use following function:
public int GetMaxLength()
{
        HttpRuntimeSection httpRuntime =
(HttpRuntimeSection)ConfigurationManager.GetSection("system.web/httpRuntime");
        return httpRuntime.MaxRequestLength;
}

No comments:

Post a Comment

Be the first to comment on this post.