1

I have an ASP.NET MVC 5 application, in which one of my controllers use the [Authorize] attribute to ensure the user has logged in.

Now, I would very much like to call this controller, from another context (in which the DOM/session in unavailable). I can save an earlier Auth Ticket, but how do I include it in future requests to my controller?

user1202032
  • 1,430
  • 3
  • 15
  • 36
  • If you are using your controller method outside of the MVC pipeline, then the Authorize attribute won't even do anything unless you are doing something additional to invoke action filters? – stephen.vakil Aug 31 '15 at 18:22
  • It tries to redirect me to the Login view – user1202032 Aug 31 '15 at 18:32
  • how about the [AllowAnonymous] attribute?? http://stackoverflow.com/questions/9727509/how-to-allow-an-anonymous-user-access-to-some-given-page-in-mvc – Daniel Gpe Reyes Aug 31 '15 at 19:16
  • How are you attempting to call the controller? Can you post the code in question? – stephen.vakil Aug 31 '15 at 20:04
  • You can easily reproduce this. Make any controller, and add the [Authorize] tag to it. Then try to call that controller from e.g. cURL or similar. You will be redirected to the login view. Im asking how to include the auth ticket in my request. – user1202032 Aug 31 '15 at 21:56
  • This is what you're looking for http://www.asp.net/web-api/overview/security/individual-accounts-in-web-api – dan Sep 01 '15 at 03:31

0 Answers0