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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T01:39:08+00:00 2026-06-03T01:39:08+00:00

My web-api controller has a GET method to search for domain availability with the

  • 0

My web-api controller has a GET method to search for domain availability with the route:
api/domain/query/

I would like to construct a form that GETs to this path (by the way do you think POST is better in this case?)

This is crap/bad/wrong, but it is where I am so far (PS I want the form to have an ID).
Model.Name is the domain name:

@using (Html.BeginForm("query", "api/domain", FormMethod.Get, new { id = "domain-query" }))
{
    @Html.ValidationSummary(true)
    <div class="editor-field">
        @Html.EditorFor(Model => Model.Name)
        @Html.ValidationMessageFor(Model => Model.Name)
    </div>
    <p>
        <input type="submit" value="Search" />
    </p>
}

This will result in: api/domain/query?Name=test instead of api/domain/query/test

Appreciate your help and I know its a noob question sorry.

  • 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-03T01:39:11+00:00Added an answer on June 3, 2026 at 1:39 am

    Couple of things here:

    1) Do not use GET for your form. MVC forms in this manner should be POSTed except in special cases.

    2) Your BeginForm is wrong. You want the action name and controller name with this overload, but most times you shouldn’t have to worry about it. Again, in most cases you will want

    @using (Html.BeginForm())
    

    like so.

    You also don’t want to put a “path” for a controller when prompted for a controller. If your controller name is AppController the string for controller should simply be App.

    Looking at this example, I expect you’re going to have a bunch of other problems. Until you wrap your brain around how it’s supposed to work, you’re going to have quite a few issues to work out. I strongly suggest walking through the “Nerd Dinner” tutorial for understanding how to write MVC code.

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

Sidebar

Related Questions

The standard route for the MVC Web API is {controller}/{id}. However I'd like to
I would like to read about MVC4 WEB API's naming conventions, but I can't
I have a Web API controller action which has a parameter of type CommandMessage.
Let say I have two methods in MVC 4 Web API controller: public IQueryable<A>
I am using MVC4's WEB API to expose a controller. Initially I created created
New ASP.NET Web API HttpClient has been giving me some strange results. Here is
My small Web API project (hosted via SelfHostHttpServer ) has a few dependencies I
I'm stuck. I was using the method outlined here for wcf web api p6
I have a phone app that trys to GET data from my web api
I am programming an API that would be used by both a web app

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.