0

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

4
  • this is using the .net framework rather than .netcore correct? Commented May 16, 2019 at 6:40
  • 1
    @JohnB This is .net framework Commented May 16, 2019 at 6:41
  • What type of parameter do you want to add? is it about user or request data ? Commented May 16, 2019 at 14:10
  • Like i want to add uid when I validating token in custom authorization class Commented May 17, 2019 at 3:17

2 Answers 2

1

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.

Sign up to request clarification or add additional context in comments.

1 Comment

I don't have any issue with the authentication filter that is working fine, I have overridden the OnAuthorization method, I only want to add add an extra parameter somewhere which can be accessed in every api method
0

I solved by adding paramter in like below

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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.