0

Here is my Action Method-

[HttpPost]
        [AllowAnonymous]
        public ActionResult GlobalSearch(int searchcategory,string CityName,int? page)
        {
            string categoryName = cobj.GetCategoryNameAsperId(Convert.ToInt32(searchcategory));
            string city = CityName;
}

When i am trying to hit my method using query sting its not hitting.

http://localhost:6004/Classified/GlobalSearch?searchcategory=2002&cityName=Bangalore&page=2 

Can any one please help me finding my issue.

enter image description here

1
  • In the method signature it's named CityName and in the querystring it's city, update that to CityName. Addtionally as a side note you're using a bunch of different casing rules, you should try and stick to one set of rules Commented Jan 15, 2019 at 18:34

1 Answer 1

1

Your GlobalSearch is set for [HttpPost]. You need to switch it to [HttpGet]

Sign up to request clarification or add additional context in comments.

3 Comments

But why even though we are posting these data to the server rit??
Here you can see some more details on the why: stackoverflow.com/questions/5876809/…
Thanks the issue is [HttpPost].but any how i need to use post attribute.can u please let me know how can we post that.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.