ganku007
ganku007

Reputation: 101

How to get the source application name in Web API?

Can any one help me solving the below issue,

I have created a webapi application. The webapi can be called from any type of application (Desktop or web or mobile). I want to get the name of the application from which the webapi is called. Is it possible.??

Thanks in advance, Regards, Ganku.

Upvotes: 0

Views: 1814

Answers (1)

Martino Bordin
Martino Bordin

Reputation: 1471

I would pass a custom http header when calling the webapi from the client.

You can read the headers from the controller using the IncomingWebRequestContext.Headers Property

You could also create a filter to ensure that the httpheader is present.

Upvotes: 1

Related Questions