Pregunta

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)
    {
    }
¿Fue útil?

Solución 2

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.

Otros consejos

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.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top