NamespaceSystemLibrary.Common.Web.Extensions
HttpRequestExtensions
public static class HttpRequestExtensions
Inheritance
System.Object
HttpRequestExtensions
Returns true if the request is an ajax request represented by the header 'X-Requested-With'
var isAjax = request.IsAjaxRequest();
// true if header X-Requested-With was set to "XMLHttpRequest", else false
Type | Name | Description |
---|---|---|
Microsoft.AspNetCore.Http.HttpRequest | request |
Type | Description |
---|---|
System.Boolean |
Returns the referer as Uri or null if not found
var referer = request.IsAjaxRequest();
// referer is now the referer from the Header request, or null if not existing
Type | Name | Description |
---|---|---|
Microsoft.AspNetCore.Http.HttpRequest | request |
Type | Description |
---|---|
System.Uri |
Returns full url of the request, includes protocol, path and query:
var url = request.Url();
// for example, url is now: https://www.systemlibrary.com/hello?world=1
Type | Name | Description |
---|---|---|
Microsoft.AspNetCore.Http.HttpRequest | request |
Type | Description |
---|---|
System.String |
}