The length of the query string for this request exceeds the configured maxQueryStringLength value
In the root web.config
for your project, under the system.web
node:
<system.web>
<httpRuntime maxUrlLength="10999" maxQueryStringLength="2097151" />
...
In addition, I had to add this under the system.webServer
node or I got a security error for my long query strings:
<system.webServer>
<security>
<requestFiltering>
<requestLimits maxUrl="10999" maxQueryString="9999" />
</requestFiltering>
</security>
...
Why don't you use TempData
, it's meant to do stuff like this. So for example:
TempData["ErrorMessage"] = "An error has occured during the communication to lightstone, this is likely a timeout issue and could be the result of a bad connection. Please go back and try again.";
Check this link.
EDIT
Pass your exception message like this:
TempData["Error"] = ex.Message();
TempData["ErrorMessage"] = "An error has occured during the communication to lightstone, this is likely a timeout issue and could be the result of a bad connection. Please go back and try again.";
return RedirectToAction("Error", "Error");
Then just access it from your ErrorController
, something like:
public ActionResult Error(string ex, string message)
{
var error = (string)TempData["Error"];
// do other magic ...
}