Determining whether a request is from the server or a client c#

37 Views Asked by At

Is there a way to determine whether an OnActionExecuting(ActionExecutingContext filterContext) request is coming from the server or client?

1

There are 1 best solutions below

0
keenns On

I'm not totally sure this is completely correct, but the answer may be:

var requester = filterContext.HttpContext.Request.UrlReferrer == null ? "client" : "server";

(I.e. if there is a referrer url, then it's a server request, if there isn't it's a client request)