Class WebUtils
Provides Web-related utility functions used by the majority of projects
Inheritance
System.Object
WebUtils
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: Azos
Assembly: Azos.dll
Syntax
public static class WebUtils
Fields
JS_RESERVED_WORDS
JavaScript reserved words
Declaration
public static readonly HashSet<string> JS_RESERVED_WORDS
Field Value
Type |
Description |
System.Collections.Generic.HashSet<System.String> |
|
PATH_JOIN_TRIM_CHARS
Declaration
public static readonly char[] PATH_JOIN_TRIM_CHARS
Field Value
Type |
Description |
System.Char[] |
|
Methods
ComposeURLQueryString(IDictionary<String, Object>)
Returns a URL query string representation of KVP[string, object]
Declaration
public static string ComposeURLQueryString(IDictionary<string, object> qParams)
Parameters
Type |
Name |
Description |
System.Collections.Generic.IDictionary<System.String, System.Object> |
qParams |
|
Returns
Type |
Description |
System.String |
|
EscapeAllDataStringChars(String)
Escapes all chars except latin A..Z, 0..9, and . - _
This function is based on EscapeDataString but does not depend on .NET 4/4.5 differences encoding ! * ( ) and others...
Declaration
public static string EscapeAllDataStringChars(this string str)
Parameters
Type |
Name |
Description |
System.String |
str |
|
Returns
Type |
Description |
System.String |
|
EscapeJSLiteral(String)
Escapes JS literal, replacing / \ \r \n " ' < > & chars with their hex codes
Declaration
public static string EscapeJSLiteral(this string value)
Parameters
Type |
Name |
Description |
System.String |
value |
|
Returns
Type |
Description |
System.String |
|
EscapeURIDataStringWithQuotes(String)
Performs URI.EscapeDataString with additional replacement of " and ' chars with their hex equivalents.
This method is suitable for escaping client-side intelligent keys that may have single/double quotes
Declaration
public static string EscapeURIDataStringWithQuotes(this string uri)
Parameters
Type |
Name |
Description |
System.String |
uri |
|
Returns
Type |
Description |
System.String |
|
EscapeURIStringWithPlus(String)
Performs escaping plus sign in URL into its hex value
Declaration
public static string EscapeURIStringWithPlus(this string uri)
Parameters
Type |
Name |
Description |
System.String |
uri |
|
Returns
Type |
Description |
System.String |
|
IsValidJSIdentifier(String)
Returns true when supplied name can be used for JS identifier naming (var names, func/class names etc..)
Declaration
public static bool IsValidJSIdentifier(this string id)
Parameters
Type |
Name |
Description |
System.String |
id |
|
Returns
Type |
Description |
System.Boolean |
|
JoinPathSegs(String[])
Joins URI path segments with "/". This function just concats strings, it does not evaluate relative paths etc.
The first segment may or may not start with '/'
Declaration
public static string JoinPathSegs(params string[] segments)
Parameters
Type |
Name |
Description |
System.String[] |
segments |
|
Returns
Type |
Description |
System.String |
|
StripSimpleHtml(String)
Strip simple html from string
Declaration
public static string StripSimpleHtml(this string str)
Parameters
Type |
Name |
Description |
System.String |
str |
|
Returns
Type |
Description |
System.String |
|