Quantcast
Channel: ASPNETWebStack Issue Tracker Rss Feed
Viewing all articles
Browse latest Browse all 7215

Closed Issue: Add extension method to HttpRequestMessage so that user can find out whether the request is coming from Local box [833]

$
0
0
Internally, we have save the IsLocal result in the HttpRequestMessage's property bag. Here are where we populate them.

SelfHost: HttpSelfHostServer.ProcessRequestContext()

// Add information about whether the request is local or not
request.Properties.Add(HttpPropertyKeys.IsLocalKey, new Lazy<bool>(() => IsLocal(requestContext.RequestMessage)));

WebHost: HttpControllerHandler.ConvertRequest()
// Add information about whether the request is local or not
request.Properties.Add(HttpPropertyKeys.IsLocalKey, new Lazy<bool>(() => requestBase.IsLocal));

Here is where it is consumed:

We needed this information to figure out whether to include error details or not.

We could add an extension method on the http request message to help user figure out if the request is local or not. So user can write code like the following:

Request.IsLocal();



Viewing all articles
Browse latest Browse all 7215

Trending Articles