System Library Common Framework
Search Results for

    *.Benchmark*,*.Tests*,*.ApiTests*,*.BaseTest*,DelegateJsonConverter,CalleeCancelledRequestException,ClientResponse,ContentType,OutputCachePolicy
    Show / Hide Table of Contents Show / Hide Table of Contents
    NamespaceSystemLibrary.Common.Framework.App.Extensions SystemLibrary.Common.Framework.App.dll

    HttpRequest extensions

    HttpRequestExtensions

    public static class HttpRequestExtensions

    Inheritance
    object
    HttpRequestExtensions
    Examples
    Arguments
    X

    Methods

    Returns the Accept as string or null if not found

    public static string Accept(this HttpRequest request)

    X
    var accept = request.Accept();
    // accept is now the accept header value from the request, or null if not existing
    X
    Methods arguments
    Type Name Description
    HttpRequest request
    X
    Type Description
    string

    Returns the Content-Type as string or null if not found

    public static string ContentType(this HttpRequest request)

    X
    var contentType = request.ContentType();
    // contentType is now the 'Content-Type' header value from the request, or null if not existing
    X
    Methods arguments
    Type Name Description
    HttpRequest request
    X
    Type Description
    string

    Returns true if the request is an ajax request represented by the header 'X-Requested-With'

    public static bool IsAjaxRequest(this HttpRequest request)

    X
    var isAjax = request.IsAjaxRequest();
    // true if header X-Requested-With was set to "XMLHttpRequest", else false
    X
    Methods arguments
    Type Name Description
    HttpRequest request
    X
    Type Description
    bool

    HttpRequest extensions

    public static bool IsFileRequest(this HttpRequest request)

    X
    Methods arguments
    Type Name Description
    HttpRequest request
    X
    Type Description
    bool

    Returns the referer as Uri or null if not found

    public static Uri Referer(this HttpRequest request)

    X
    var referer = request.Referer();
    // referer is now the referer from the Header request, or null if not existing
    X
    Methods arguments
    Type Name Description
    HttpRequest request
    X
    Type Description
    Uri

    Get the full url of the request, includes protocol, schema, path and query string

    public static string Url(this HttpRequest request)

    X
    var url = request.Url();
    // for example, url is now: https://www.systemlibrary.com/hello?world=1
    X
    Methods arguments
    Type Name Description
    HttpRequest request
    X
    Type Description
    string

    Full url of the request, or null if request is null

    Returns the User-Agent as string or null if not found

    public static string UserAgent(this HttpRequest request)

    X
    var userAgent = request.UserAgent();
    // userAgent is now the 'User-Agent' header value from the request, or null if not existing
    X
    Methods arguments
    Type Name Description
    HttpRequest request
    X
    Type Description
    string

    }

    In This Article
    Package: nuget
    Source: github
    Website: System Library Common Framework