Filter AuthorizeAttribute custom Roles

Hello everyone!

I am writing application and i would like use Filter Authorize. Default attribute [Authorize(Roles="user")] doesnt work becaues I don’t use membership or simplemembership. I just use my database. My question
what method
should I
modify
and put in the
code
to take concret role from databes
for the logged-patient? Inside database i have tables: Patient, patientInRoles, Roles.

Greatings!

I think, you would need to create the Custom AuthorizeFilter attribute and have a property called Roles inside it. Finally, override
OnAuthorization method to implement your own way of doing it. Return the result with
HttpUnauthorizedResult object.

Refer

http://stackoverflow.com/questions/17509837/customize-authorize-filter-attribute-parameter

Leave a Reply