2
    [Route("api/test")]
    public IEnumerable<Tests> GetTests()
    {
         //Retrieve ajax header here?? 
        return ClassTestfuntions.Testmethod();     
    }

I have this asp.net web api method that i use to GET a list of rows from my db, im now also sending an header to this method within my ajax http get call but im not sure how to retrieve it's value, any help or input highly appreciated, thanks!

1 Answer 1

1

You can pull it from the request headers as follows:

var headers = Request.Headers.GetValues("AjaxHeader");
var ajaxHeader = headers.FirstOrDefault();
Sign up to request clarification or add additional context in comments.

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.