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 8200673
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T06:31:51+00:00 2026-06-07T06:31:51+00:00

I have a Action method like this [HttpPost] public ActionResult DoSearchRequestOperation(SearchRequestModelDto data) { //..

  • 0

I have a Action method like this

[HttpPost]
public ActionResult DoSearchRequestOperation(SearchRequestModelDto data)
{
     //..
}

when I us this url string http://localhost:9124/Search/SearchRequest?searchRequestFor=0 , it works. but when i use the url http://localhost:9124/Search/SearchRequest?searchRequestFor= , it is throwing this exception

System.ArgumentException: The parameters dictionary contains a null
entry for parameter ‘searchRequestFor’ of non-nullable type
‘xxxx.Shared.Dto.Process.Search.SearchRequestFor’ for method
‘System.Web.Mvc.ActionResult
SearchRequest(xxxx.Shared.Dto.Process.Search.SearchRequestFor)’ in
‘xxxx.WebServer.UI.Controllers.SearchController

if the user is giving second url it should take the value 0.

I tried changing the maproute like below, but that also is not working.

  routes.MapRoute(
            "Default1", // Route name
            "{controller}/{action}/{id}", // URL with parameters
            new { controller = "Home", action = "Dashboard", id = 0 } 
        );

Here is the SearchRequestModelDto class

[DataContract]
public class SearchRequestModelDto : UIBoundDto
{
    public SearchRequestModelDto()
    {
        Criteria = new SearchRequestCriteriaDto();
        SearchResult = new SearchRequestResultDto();
    }

    [DataMember]
    public SearchRequestCriteriaDto Criteria { get; set; }

    [DataMember]
    public SearchRequestResultDto SearchResult { get; set; }
}
  • 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-06-07T06:31:52+00:00Added an answer on June 7, 2026 at 6:31 am

    You could make the SearchRequestFor property on your SearchRequestModelDto view model a nullable integer if you want to be able to send null values in the query string:

    public int? SearchRequestFor { get; set; }
    

    The fact that you have set id=0 in your route has no influence on query string parameters. They are not governed by routes so you will have to either write a custom model binder or use a nullable integer on the model. The latter is preferred.

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

Sidebar

Related Questions

I have an [HttpPost] action method signature like this: [HttpPost] public ActionResult Edit(ExistingPostViewModel model)
I have this action method: [HttpPost] public ActionResult GetNextImage(int m_id) { ... return Json(new{...});
I have methods like this: [HttpPost] public ActionResult Delete(BaseViewModel vm) { public ActionResult Delete(string
I have a method like this: public List<Fruit> Traverse (IEnumerable<Fruit> collection, Action<Fruit> action) I
If I have a controller like this: [HttpPost] public JsonResult FindStuff(string query) { var
I have an MVC Action..... [HttpPost] public ActionResult DoStuff(string myString, DateTime myDateTime) ...and I'm
I have a MVC3 action method with 3 parameters like this: var url =
I have a method... [HttpPost] public ActionResult Start(SomeViewModel someViewModel) { ... } that based
I have a action result method i would like to run. How can i
I have problem with ObjectContext.SaveChanges method: public void Save(Action<object, object> action) { EventAggregator.GetEvent<EntityServiceRequestingEvent>().Publish(true); var

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.