views:

90

answers:

3

I was getting 404 errors for some long URLs on a website I'm developing. After a bit of digging I discovered that this occurs when the length of certain aspects of the URL exceed configurable limits in IIS7. In this case the maxQueryString attribute of the requestLimits property needed to be increased in the web.config

<system.webServer>
<security>
  <requestFiltering>
    <requestLimits maxQueryString="4096" maxAllowedContentLength="4096" maxUrl="8192" >
    </requestLimits>
  </requestFiltering>
</security>

This fixed the problem instantly on my development server but on the remote server I now get:

500 - Internal server error.

There is a problem with the resource you are looking for, and it cannot be displayed.

And that's all the information it gives me.

+1  A: 

You should not use such long URLs. Among other reasons, at least one of the common toolbars (Bing, Yahoo, Google) will break them, producing just such errors. Users will blame you.

I know this because one of my users was having just such a problem with a legacy app. When I removed the toolbars (she had all three installed!), the problem went away.

egrunin
I need to send hundred of parameters through the querystring from Flash I'm not sure how else to do it.
Chris Porter
@Chris Porter: There's not a way to POST data from Flash?
animuson
A: 

Are you sure your hoster/production-server is running Windows Server 2008 (or 2008 R2)? The settings you are describing above are only valid for IIS 7+.

CarlosAg
It's Windows Server 2008 - Web Edition
Chris Porter
+2  A: 

Change your Flash to send the data as POST, so it won't be appended to the URL. Here's some sample code. Also, you may need to change the server side to look for the data as POST instead of GET.

fenomas
Chris Porter
I don't know anything about the asp side, but if you don't see a good way to get the data out of POST easily, open a question on it - because that's your problem, not this. ;) Even if you get this working, it's just going to fail again when someone's browser or toolbar or add-on truncates the URL. (It seems IE has a limit of 2048 chars, or used to.) POST is the correct approach for what you're doing.
fenomas