I’m working with Asp.net WebApi that has forms authorization. I’ve succeeded in creating POST request to the contoller, that is secured with [Authorize] attribute by using HttpClient that first goes to authorization controller, which stores cookie to it and client uses it for the other request. For the GET requests I’d want to use Linq2Rest library, which uses JsonRestClient, but I don’t see how can I use it for authorization. I’m very surprised that I couldn’t find any question or discussion on that topic. Is the modifying of the sources of this library the only one way to solve this problem?
Update:
I use just usual forms authorizasion.
This is how GET method looks like
[Authorize]
[Queryable]
public IQueryable<Invoice> GetInvoices()
{
return repository.GetInvoices();
}
I’ve created own RestClient to solve this problem, not sure if is the best solution, but this seems to work for me. Here currentHttpClient is the object that already has authentication cookie.