Reputation: 2718
I'm in the final stage of my MVC 4 project , adding the authorization to the controller, start causing the redirection to home page each time the user made the submit or request and either he was logged in or out , any idea can help here?
[Authorize]
[HttpPost]
[AcceptVerbs(HttpVerbs.Post)]
public ActionResult Create(uoffer uoffer, IEnumerable<HttpPostedFileBase> fileupload)
{
}
Upvotes: 0
Views: 257
Reputation: 2718
Okay finally I figure it thank for fiddle tool, for any one having same behavior, please Notice that the log-off method is made through form submitting. In my case i was having another block of code doing form.submit() method, my mistake was that I didn't scope and make more specific . I mean instead of $('form').submit()... it should be $('form#formID').submit() > Since the first one was general scope and when I was trying to firing it, it was triggering The Log Off form instead of My form.
Upvotes: 0
Reputation: 12174
delete one of the duplicate attributes - [HttpPost] = [AcceptVerbs(HttpVerbs.Post)]. Then are you using [Authorize] on the Get? You need to have the user authenticated before you try to POST.
Upvotes: 1