Different situations occur when action information is not given when the form is posted.

Yalçın Mete 60 Reputation points


If you allow, I would like to ask a question.

Even though I did not provide action information in the form post operation in the View of the "Index Action" in the "Login Controller", the Index Action is running in the post operation.

Although I did not provide action information in the post action in the "SubscribeMail View", the Subscribe Action to which it is connected does not work. Shouldn't the Action Method in the control it is connected to work by default?

Note: SubscribeMail View is a partial view.
User's image

User's image

User's image

User's image


A set of technologies in the .NET Framework for building web applications and XML web services.
4,373 questions
0 comments No comments
{count} votes

Accepted answer
  1. AgaveJoe 27,581 Reputation points

    Partial Views are rendered within another View. The code you've shared does not show the View that contains the partial or the controller that rendered the parent View. It would help if you provided this information.

    With that being said, the browser will POST to the URL in the browser's address bar when the form element does not specify an action attribute. For example, if the SubscribeMail partial is rendered within the Views/Login/Index view then the URL in the browser is /Login assuming you are not using Areas. Clicking a submit button in this situation POSTs to the /Login/Index route.

    It is important to mention that nested HTML forms is invalid HTML. I can't tell from the screenshots if you have this problem or not but it is possible given the partial contains a form element. Be careful to not nest HTML forms.

    Lastly, when posting question on these forums it is best to post all the relevant source code using the "code block" button because gives the community an opportunity to copy the code and run a test based on your source code.

    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful