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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T16:51:33+00:00 2026-05-26T16:51:33+00:00

Ive built a form that I need to post back on. I have put…

  • 0

Ive built a form that I need to post back on. I have put…

@using (Html.BeginForm(){
}

But I don’t see the point in using the parameter-less method call because I don’t see how the form knows which URL to post to? Ive seen some example using it and they seem to generate the correct url but I dont really know why my one doesn’t?

  • 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-26T16:51:34+00:00Added an answer on May 26, 2026 at 4:51 pm

    But I don’t see the point in using the parameter-less method call
    because I don’t see how the form knows which URL to post to?

    It posts to the url that the client browser is currently pointing to. Here is how it is implemented:

    public static MvcForm BeginForm(this HtmlHelper htmlHelper)
    {
        string rawUrl = htmlHelper.ViewContext.HttpContext.Request.RawUrl;
        return htmlHelper.FormHelper(rawUrl, FormMethod.Post, new RouteValueDictionary());
    }
    

    As you can see it simply uses the same url as the one that was used to render the form.

    The point is that in a RESTful ASP.NET MVC application you usually have 2 actions with the same name but accessible accessible through different verbs:

    public class HomeController: Controller
    {
        public ActionResult Index()
        {
            MyViewModel model = ...
            return View(model);
        }
    
        [HttpPost]
        public ActionResult Index(MyViewModel model)
        {
            ...            
        }
    }
    

    The first action is used to render the form and the second action is used to process the submission of the form. So when you use Html.BeginForm without any arguments on the view that the first action rendered you are no longer hardcoding any action or controllers in the view. You are relying on standard ASP.NET MVC conventions. It is the right way to do.

    Of course if you want to post to some different action or controller you will have to use the proper overload of the BeginForm method and specify them.

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

Sidebar

Related Questions

So I have a form, but I don't need to be submitting the information
I have a form which will include some optional questions that need to asked
I've built a Django form that submits to a page on another domain (that
I have a textbox on a MS Access form that users are going to
I have a RIA service (CustomDomainService), which is composed by few methods that need
I realize that this is probably a very basic question, but I have spent
I have been asked to build a rather simple form processor application that interacts
I have built a simple rails app with three classes that inherit from ActiveRecord
Possible Duplicate: Min Max slider to form I presently have a search module that
I've built a form with Netbeans's visual editor. When I press one of the

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.