Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7000177
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T20:38:16+00:00 2026-05-27T20:38:16+00:00

I have a request to one of my actions in a controller that expects

  • 0

I have a request to one of my actions in a controller that expects an enum as a key in the Querystring. I can see that the same is set in the QueryString but an exception is thrown by the server saying the same is not set and the error:

The parameters dictionary contains a null entry for parameter ‘enumVar’ of non-nullable type.

is thrown.

Here are the exception details:

Exception type: System.ArgumentException

Exception message: The parameters dictionary contains a null entry for parameter ‘enumVar’ of non-nullable type ‘NameSpace.Enums.MyEnum’ for method ‘System.Web.Mvc.ActionResult GetContent(Int64, NameSpace.Enums.MyEnum, System.String, Int32, Int32, Int32, Int32, Int64)’ in ‘NameSpace.Controllers.MyController’. An optional parameter must be a reference type, a nullable type, or be declared as an optional parameter.

Parameter name: parameters

Request URL: http://myawesomeurl.local/app/My/GetContent?abc=a_123&xyz=434&enumVar=EnumValue&teamId=a_123&a=0&b=1&c=3&qwerty=123&token=234234231

Request path: app/My/GetContent

Let me know if you need more information. I am not sure how I should address the issue.

Update:
My Enum defination:

public enum DisplayMode
{
    EnumValue,
    EnumValue1,
    EnumValue2
}

Also I should mention that the request fails only sometimes and not always and this is not consistent. This is an error that was logged in our exception db.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T20:38:16+00:00Added an answer on May 27, 2026 at 8:38 pm

    It looks like the Default Model Binder is not dailed into enumerations. Your best bet would be to subclass the DefaultModelBinder class and handle the scenario where a property is an enum.

    public class U413ModelBinder : DefaultModelBinder 
    { 
        /// <summary> 
        /// Fix for the default model binder's failure to decode enum types when binding to JSON. 
        /// </summary> 
        protected override object GetPropertyValue(ControllerContext controllerContext, ModelBindingContext bindingContext, 
            PropertyDescriptor propertyDescriptor, IModelBinder propertyBinder) 
        { 
            var propertyType = propertyDescriptor.PropertyType; 
            if (propertyType.IsEnum) 
            { 
                var providerValue = bindingContext.ValueProvider.GetValue(bindingContext.ModelName); 
                if (null != providerValue) 
                { 
                    var value = providerValue.RawValue; 
                    if (null != value) 
                    { 
                        var valueType = value.GetType(); 
                        if (!valueType.IsEnum) 
                        { 
                            return Enum.ToObject(propertyType, value); 
                        } 
                    } 
                } 
            } 
            return base.GetPropertyValue(controllerContext, bindingContext, propertyDescriptor, propertyBinder); 
        } 
    } 
    

    Code and logic courtesy of this question.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a request in from a client that would like one of their
One of my controllers actions, one that is being called in an Ajax request,
I have a POST request coming to one of my pages, here is a
I have two requests in tomcat. One HTTP request will create a thread. Client
I have two list on my request on jsp. First one is productGroupName, and
I have 100 web servers and noticed that some of them have request filtering
I have a request for some contract work from an organization that uses Excel
I have a request that returns a JSON object with a single property which
I have this set of routes: routes.MapRoute( IssueType, issue/{type}, new { controller = Issue,
I have a Controller bean (SearchController) that has two managed bean as managed properties

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.