Reputation: 8606
I have some issue regarding REST API which i have built using servicestack. End user will consume this API from their application hosted on their server. I'd like to grab absolute uri and IP address from which this REST API being consumed.
When i am doing testing it locally as per below then it gives me URL of REST API itself instead of application from where it is consuming.
string str = RequestContext.AbsoluteUri.ToString();
Please how can i get details about source from where my REST API is consuming.
Thanks in Advance.
Upvotes: 3
Views: 1568
Reputation: 143319
I'm not sure I understand this question correctly, do you want the referrer url? or physical location path? Either way the Original ASP.NET request object should have all the information you need which you can access in your webservice with:
var aspnetReq = (HttpRequest)RequestContext.Get<IHttpRequest>().OriginalRequest;
Which you can use to access all information about the request.
Upvotes: 1