asp.net mvc 4 - Needing nullable parameter in .net mvc controller even tho always called with value -
so web application made hosting shut down pool 503 errors (probably rapid failure). hosting sent me piece.
^? exception type: argumentexception ^? exception message:^?the parameters dictionary contains null entry parameter 'pagenum' of non-nullable type 'system.int32' method 'system.web.mvc.actionresult ajaxfetch(int32, int32)' in 'frontend.controllers.blogcontroller'. optional para and signature method is
(no attributes above, can called get)
public actionresult ajaxfetch(int pagenum, int pagesize) now easy, can change ints int? , voila. , thats did. questions of curiosity. why did fail, since ever call function js/jquery params set. , therefore code worked. apperantly generated errors in background. why that. no 1 calling null , yet failed that.
finally include routing there no glitch there, here both routes, have nothing else
routes.maproute( name: "stalksaveold", url: "geoshare", defaults: new { controller = "stalk", action = "savecoordinate" } ); routes.maproute( name: "default", url: "{controller}/{action}/{id}", defaults: new { controller = "blog", action = "index", id = urlparameter.optional } ); and btw ajaxfetch in blogcontroller
why did fail, since ever call function js/jquery params set.
my guess something else (a robot?) calling without including parameters.
i'd suggest changing use nullable types moment, fail error if detect either value null, after logging diagnostic information (user agent, client ip address, full request url).
Comments
Post a Comment