Class FileExtensionWhitelist
Inheritance
Namespace: DotNetNuke.Common.Utilities
Assembly: DotNetNuke.dll
Syntax
public class FileExtensionWhitelist : object
Constructors
| Improve this Doc View SourceFileExtensionWhitelist(String)
Initializes a new instance of the FileExtensionWhitelist class.
Declaration
public FileExtensionWhitelist(string extensionList)
Parameters
Type | Name | Description |
---|---|---|
System.String | extensionList | a comma seperated list of file extensions with no '.'. |
Remarks
extensionList
should match the format used in the FileExtensions Host setting specifically it
should not have an '.' in the extensions (e.g. txt,jpg,png,doc).
Properties
| Improve this Doc View SourceAllowedExtensions
Gets the list of extensions in the whitelist.
Declaration
public IEnumerable<string> AllowedExtensions { get; }
Property Value
Type | Description |
---|---|
IEnumerable<System.String> |
Remarks
All extensions are lowercase and prefixed with a '.'.
Methods
| Improve this Doc View SourceIsAllowedExtension(String, IEnumerable<String>)
Indicates if the file extension is permitted by the Host Whitelist.
Declaration
public bool IsAllowedExtension(string extension, IEnumerable<string> additionalExtensions)
Parameters
Type | Name | Description |
---|---|---|
System.String | extension | The file extension with or without preceding '.'. |
IEnumerable<System.String> | additionalExtensions |
Returns
Type | Description |
---|---|
System.Boolean | True if extension is in whitelist or whitelist is empty. False otherwise. |
IsAllowedExtension(String)
Indicates if the file extension is permitted by the Host Whitelist.
Declaration
public bool IsAllowedExtension(string extension)
Parameters
Type | Name | Description |
---|---|---|
System.String | extension | The file extension with or without preceding '.'. |
Returns
Type | Description |
---|---|
System.Boolean | True if extension is in whitelist or whitelist is empty. False otherwise. |
RestrictBy(FileExtensionWhitelist)
Declaration
public FileExtensionWhitelist RestrictBy(FileExtensionWhitelist parentList)
Parameters
Type | Name | Description |
---|---|---|
FileExtensionWhitelist | parentList |
Returns
Type | Description |
---|---|
FileExtensionWhitelist |
ToDisplayString()
Returns a string suitale for display to an end user.
Declaration
public string ToDisplayString()
Returns
Type | Description |
---|---|
System.String | A String of the whitelist extensions formatted for display to an end user. |
ToDisplayString(IEnumerable<String>)
Formats the extension whitelist appropriate for display to an end user.
Declaration
public string ToDisplayString(IEnumerable<string> additionalExtensions)
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<System.String> | additionalExtensions | A list of additionalExtensions to add to the current extensions. |
Returns
Type | Description |
---|---|
System.String | A String of the whitelist extensions formatted for storage display to an end user. |
Remarks
additionalExtensions
case and '.' prefix will be corrected, and duplicates will be excluded from the string.
ToStorageString()
Formats the extension whitelist appropriate for storage in the Host setting.
Declaration
public string ToStorageString()
Returns
Type | Description |
---|---|
System.String | A String of the whitelist extensions formatted for storage as a Host setting. |
ToStorageString(IEnumerable<String>)
Formats the extension whitelist appropriate for storage in the Host setting.
Declaration
public string ToStorageString(IEnumerable<string> additionalExtensions)
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<System.String> | additionalExtensions | A list of additionalExtensions to add to the current extensions. |
Returns
Type | Description |
---|---|
System.String | A String of the whitelist extensions formatted for storage as a Host setting. |
Remarks
additionalExtensions
case and '.' prefix will be corrected, and duplicates will be excluded from the string.
ToString()
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
System.String |