0
votes

I have two actions in the same name (the normal LongTailSearchBox is showing drop list of the categories, and the HttpPost make the search page (if not exists) and the\n redirect to the search page

 public ActionResult LongTailSearchBox()
            {
 return View();
}

And the httpPost of the action

[HttpPost]
         public ActionResult LongTailSearchBox(string cat1, string cat2, string cat3, string cat4)
         {
return RedirectToAction("LongTailSearchResult", "LongTailSearch", new { name = _url });
    }

when I click on the login button (another form) it's return http post of-course..

so the HttpPost LongTailSearchBox is start too when the page is loading (I want it to start only if the someone click on the button of the Search and not any button that make httpPost..)

how to do it??

Update:

when I change the name of one of those actions is work like a charm, but I want them in the same name

and the login forsm of the html are <form method="post" action="/LongTailSearch/LongTailSearchBox" novalidate="novalidate">

and

<form method="post" action="/login" novalidate="novalidate">
1
is your login form's action method set as longteailsearchbox ? - Shyju
[NopHttpsRequirement(SslRequirement.Yes)] public ActionResult Login(bool? checkoutAsGuest) and [HttpPost] [CaptchaValidator] public ActionResult Login(LoginModel model, string returnUrl, bool captchaValid) - Daniel Ezra
by the way , when I change the name of one of the action is work like a charm, but I want them in the same name - Daniel Ezra
and the login form of the html is <form method="post" action="/login" novalidate="novalidate"> - Daniel Ezra
Why are you creating two questions for the same issue? - von v.

1 Answers

1
votes

You could use ActionMethodSelectorAttribute to select the action depending on the name of the button which caused the post, as explained here: http://www.dotnetcurry.com/ShowArticle.aspx?ID=724