NibblyPig
NibblyPig

Reputation: 52922

How do I increase the maxUrlLength property in the config in asp.net MVC 3?

I am getting this error:

The length of the URL for this request exceeds the configured maxUrlLength value.

Looking around the closest thing I can find is in the web.config,

<requestFiltering>
   <requestLimits maxUrl="xxx">
</requestFiltering>

However this is not MaxUrlLength nor does it resolve the issue. Any ideas how to fix?

Upvotes: 56

Views: 62208

Answers (6)

Marcel Gruber
Marcel Gruber

Reputation: 7485

In my case, I edited the setting visually in the IIS application (Request Filtering area):

request filtering url length

This action modified my web.config as follows:

<security>
  <requestFiltering>
    <requestLimits maxAllowedContentLength="524288000" maxQueryString="4096" />
  </requestFiltering>
</security>

As was mentioned in some of the other answers, be sure to also consider long query strings in the request.

Upvotes: 0

Hector Correa
Hector Correa

Reputation: 26690

Take a look at this post by Hanselman. Although this post is about accepting typically invalid characters in the URL he also mentions how to configure the length of the path and the query string

While we're in here, note that in ASP.NET 4 you can also change allowed path and queryString lengths:

<httpRuntime maxRequestPathLength="260" maxQueryStringLength="2048" />

Upvotes: 10

user3594326
user3594326

Reputation: 17

Having the same problem in IIS8, the solution was to modify the root Web.config for the .NET Framework. This file is located in %windir%\Microsoft.NET\Framework\framework_version\CONFIG. Editing the web.config file in the site root did not resolve the issue.

Upvotes: 0

Van
Van

Reputation: 88

I had this problem in a rest service I created using C# .net 4. I set the maxUrlLength variable, in the system.web section, of the Web.Config file.

<?xml version="1.0"?>
<configuration>

  <system.web>
    <compilation debug="true" targetFramework="4.0" />
    <httpRuntime maxUrlLength="2000"/>
  </system.web>
....

Upvotes: 6

Jesse
Jesse

Reputation: 8393

As per Ashok's answer that would equate to:

<httpRuntime maxUrlLength="1024" relaxedUrlToFileSystemMapping="true"/>

within <system.web> section of the web.config.

Upvotes: 87

Ashok Padmanabhan
Ashok Padmanabhan

Reputation: 2120

have you seen this msdn article that seems to what you need

Upvotes: 3

Related Questions