c# - MVC Application_start localhost redirected you too many times -


i error:

localhost redirected many times.

when redirect error page application_start method.

my code looks this:

 protected void application_start()     {         arearegistration.registerallareas();         routeconfig.registerroutes(routetable.routes);     }      protected void application_error(object sender, eventargs e)     {             var exception = server.getlasterror();             if (exception != null)         {                 session["w"] = exception;             response.clear();             server.clearerror();             response.redirect("~/admin/error");             }     } } 

it not idea use session in case. if error triggered ihttphandler not marked irequiressessionstate, accessing session fail. so, have redirect loop.

remove using of session , try use:

response.redirect(string.format("~/admin/error?w={0}", exception.message)); 

Comments

Popular posts from this blog

mysql - Dreamhost PyCharm Django Python 3 Launching a Site -

java - Sending SMS with SMSLib and Web Services -

java - How to resolve The method toString() in the type Object is not applicable for the arguments (InputStream) -