c# - The length of the query string for this request exceeds the configured maxQueryStringLength value -


i trying redirect view , keep getting error posted in question title.

during breakpoint testing code passing though first bit of code iv lay down below setting message , setting exception. after continuing after return redirect next page displayed follows.

enter image description here

adding break points errorcontroller , error model found code never gets there.

the view i'm trying post error page. here code see problem.

the redirecttoaction:

string message; message = "an error has occured during communication lightstone, timeout issue , result of bad connection. please go , try again."; return redirecttoaction("error", "error", new { ex = ex.tostring(), message =  message}); 

the action in errorcontroller:

public actionresult error(string ex, string message) {    viewbag.message = "error";    return view(new errormodel(ex, message)); } 

my error model:

namespace mvcrescomm.models {     public class errormodel     {         public string ex { get; set; }         public string message { get; set; }          public errormodel(string ex, string message)         {             this.ex = ex;             this.message = message;         }     } } 

why don't use tempdata, it's meant stuff this. example:

tempdata["errormessage"] = "an error has occured during communication lightstone, timeout issue , result of bad connection. please go , try again."; 

check link.

edit

pass exception message this:

tempdata["error"] = ex.message(); tempdata["errormessage"] = "an error has occured during communication lightstone, timeout issue , result of bad connection. please go , try again.";  return redirecttoaction("error", "error"); 

then access errorcontroller, like:

public actionresult error(string ex, string message) {     var error = (string)tempdata["error"];     // other magic ... } 

Comments