c# - ASP.net Web API Unauthorised Access -




i have set new asp.net mvc , web api application default individual accounts authentication system, , have working regular controllers authorise attribute, when try same web api controller, hit unauthorised access, despite having access initial index page. once logged in , on index page, click button fires off request api, reason receives unauthorised request. missing?

does work:

[authorize] public class homecontroller : controller {     public actionresult index() {         return view();     }  } 

doesn't work:

public class taskscontroller : apicontroller {     [authorize]     [httpget]     public ienumerable<usertask> getalltasks() {          using (var db = new testdb()) {             var tasks = db.usertasks.where(o => o.createdbyuser == user.identity.name).tolist();              return tasks;         }     } } 





wiki

Comments

Popular posts from this blog

Asterisk AGI Python Script to Dialplan does not work -

python - Read npy file directly from S3 StreamingBody -

kotlin - Out-projected type in generic interface prohibits the use of metod with generic parameter -