0

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)
    {
    }
4
  • check the web.config file for <form loginurl=''/>.
    – tiru
    Dec 15, 2012 at 13:15
  • Can you give a little more details of exactly what is happening and specifically how you are logging the person in? Dec 15, 2012 at 13:38
  • @tiru This is the tag <forms loginUrl="~/Account/Login" timeout="2880" />
    – 0xFK
    Dec 15, 2012 at 21:12
  • @NickLarsen currently External Authentication,i will try simplify the problem tomorrow and upload the sample online thank you
    – 0xFK
    Dec 15, 2012 at 21:15

2 Answers 2

1

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.

4
  • Okay here sample of the problem it related to [Authorize] , just check here 1-go to (mindsshare.com)[1] 2- login and choose sell option 3- click "Create" without filling information , and you will redirected to the home page ! note : removing [authorize] from class preventing the redirection behavior !!
    – 0xFK
    Dec 16, 2012 at 12:59
  • I would add [Authorize] to the GET action for /Offer/Create Dec 16, 2012 at 18:28
  • [Authorize] had been added , issue still same , looks like from client side... i will try to debug there
    – 0xFK
    Dec 17, 2012 at 4:00
  • Removing the model Validation has fixed the issue , it turned out that some problem in validation ,causing the application to log off, any ideas about this case ?
    – 0xFK
    Dec 17, 2012 at 15:01
0

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.