[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 805
  • Last Modified:

MVC how to post to another controllers ActionResult

Say I have a view called customer with a customers controller.

On the view there is a separate form called CheckCredentials.   This is an ActionResult in the Credentials controller.

How can I post to this controller from the customers view?   So in my customers view I have

 <% using (Html.BeginForm("CheckCredentials", "Credentials", new { id = 3 }), FormMethod.Postt, null))

But if I submit this form it it is looking for the view ../Credentails/CheckCredentials/

I just want to do hit this view and do some processing and return to the customers view like

return RedirectToAction("Details", "Customers", new { Id = id });

What am I doing wrong?
0
ToString1
Asked:
ToString1
1 Solution
 
robastaCommented:
use:

using (Html.BeginForm("Action", "Controller", FormMethod.Post,
  new { id = "FormID" })

Open in new window


or go to basic html

<form action="/Complete/Url/Here" method="post">    
        
</form>

Open in new window


0

Featured Post

Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now