Md. Parvez Alam
Md. Parvez Alam

Reputation: 4596

.Net Web API Add attribute in request

I have created an web api in .net I have custom authroization filter which check for token before executing the API method.

I want to add a custom attribute in custom authorization filter and get this attribute in every api method.

Custom authorize

 public override void OnAuthorization(System.Web.Http.Controllers.HttpActionContext actionContext)
{
 }

How to do this.

Thanks

Upvotes: 0

Views: 1070

Answers (2)

Md. Parvez Alam
Md. Parvez Alam

Reputation: 4596

I solved by adding paramter in like below

Request.Properties.Add("test", "test");

Upvotes: 0

Meligy
Meligy

Reputation: 36594

This seems to be well documented here: Authentication Filters in ASP.NET Web API 2

Follow this guide and you can open a new question if you face any particular problem.

Upvotes: 1

Related Questions