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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T04:59:56+00:00 2026-06-07T04:59:56+00:00

public ActionResult Index() { Queries q1 = new Queries(); return View(q1); } public ActionResult

  • 0
public ActionResult Index()
{
    Queries q1 = new Queries();
    return View(q1);
}

public ActionResult Index(string id)
{
    Queries q1 = new Queries(id);
    return View(q1);
}

public ActionResult Select(string id)
{
    return RedirectToAction("Index",id);
}

what is wrong…

It says:
The current request for action ‘Index’ on controller type ‘CompanyController’ is ambiguous between the following action methods:
System.Web.Mvc.ActionResult Index() on type LookUpForm.Controllers.CompanyController
System.Web.Mvc.ActionResult Index(System.String) on type LookUpForm.Controllers.CompanyController

Since the Action Index one doesnot have parameters and other have a string parameter, I think it must be valid.

  • 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-07T04:59:57+00:00Added an answer on June 7, 2026 at 4:59 am

    You cannot have 2 actions on the same controller with the same name even if they take different parameters. The only way to disambiguate them is to use a different HTTP verb:

    public ActionResult Index()
    {
        Queries q1 = new Queries();
        return View(q1);
    }
    
    [HttpPost]
    public ActionResult Index(string id)
    {
        Queries q1 = new Queries(id);
        return View(q1);
    }
    

    or if both actions need to be accessible with the GET verb you will have to either find a different name or write a custom action selector.

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

Sidebar

Related Questions

Controller action: public ActionResult Index() { ViewData[sample] = DateTime.Now.ToLongTimeString(); Thread.Sleep(3000); return View(); } View
public class HomeController : Controller { public ActionResult Index() { Task<string> t = DownloadStringTaskAsync(new
Is there any difference between: public ActionResult logOff() { FormsAuth.SignOut(); return RedirectToAction(index, Home); }
This works: [HttpPost] public ActionResult Slots(Slots slots, ICollection<int> jobNos) { if (!ModelState.IsValid) return View(new
Controller action: public ActionResult Index() { probaEntities proba = new probaEntities(); probaEntities proba1 =
In the controller: public ActionResult Index() { ViewData[page] = 0; return View(data); } public
If in my controller: public ActionResult Index() { //no code implied return View; }
public ActionResult Index(){ var dataContext = new DataEvidencijaDataContext(); MembershipUser myObject = Membership.GetUser(); string KorisnickoIme
Instead of: public ActionResult Index() { ViewData[foo] = _repository.GetFoos().ToList(); ViewData[bar] = new string[] {
I have this public class HomeController{ public ActionResult Index() { //do stuff return View();

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.