asp.net mvc 3 - MVC 3 Authorize attribute not working in action method -


in web application want add authorization in action method in controller not on whole controller. added following

  [authorize]   public actionresult manageresturant(long id = 0)   {   } 

and in web.config added

<authentication mode="forms" >   <forms loginurl="~/auth/login"/> </authentication> 

but when go action method page loads wrong want page redirect login page

any suggestions?

thanks john comment found solution after hint problem in code

i use session store logged in user use of formsauthentication make sure users login make login link appears them

the problem when session expires formsauthentication still validating user logged in user appears user logged out in fact logged in using form authentication

so did onactionexecuting method make check on session if null logout user in case make sure user logged out


Comments

Popular posts from this blog

django - How can I change user group without delete record -

java - Need to add SOAP security token -

java - EclipseLink JPA Object is not a known entity type -