HttpRequestExtensions Class

System.Object
   Westwind.AspNetCore.Extensions.HttpRequestExtensions

Class Members

MemberDescription
GetRawBodyBytesAsync Retrieves the raw body as a byte array from the Request.Body stream
public static Task GetRawBodyBytesAsync(HttpRequest request, bool enableBuffering, Stream inputStream)
GetRawBodyStringAsync Retrieve the raw body as a string from the Request.Body stream
public static Task GetRawBodyStringAsync(HttpRequest request, bool enableBuffering, Encoding encoding, Stream inputStream)
GetSiteBaseUrl Returns the site base URL for the current request:https://localhost:5200/test/sub -> https://localhost:5200/
public static string GetSiteBaseUrl(HttpRequest request)
GetUrl Returns the absolute Url of the current request as a string.
public static string GetUrl(HttpRequest request)
IsFormVar Checks to see if a given form variable exists in the request form collection.
public static bool IsFormVar(HttpRequest req, string formVarName)
IsLocal Determines if the request is a local request where the local and remote IP addresses match
public static bool IsLocal(HttpRequest req)
IsPostback Determines whether request is a postback operation
public static bool IsPostback(HttpRequest request)
MapPath Maps a virtual or relative path to a physical path in a Web site,using the WebRootPath as the base path (ie. the `wwwroot` folder)
public static string MapPath(HttpRequest request, string relativePath, IWebHostEnvironment host, string basePath, bool useAppBasePath)
Params Returns a value based on a key against the Form, Query and Session collections.
public static string Params(HttpRequest request, string key)
UnbindFormVarsToObject Unbinds form variable data to an instantiated object by matching form variable name to a property nameand only updating properties that have matching form variables and leaving the rest alone.
public static List UnbindFormVarsToObject(HttpRequest request, object targetObject, string propertyExceptions, string formvarPrefixes)
Namespace: Westwind.AspNetCore.Extensions

Assembly: Westwind.AspNetCore.dll



© West Wind Technologies, 2025 • Updated: 2025-03-08
Comment or report problem with topic