• Share
    • Twitter
    • LinkedIn
    • Facebook
    • Email
  • Feedback
  • Improve this Doc

Class FileExtensionWhitelist

Inheritance
System.Object
FileExtensionWhitelist
Namespace: DotNetNuke.Common.Utilities
Assembly: DotNetNuke.dll
Syntax
public class FileExtensionWhitelist : object

Constructors

| Improve this Doc View Source

FileExtensionWhitelist(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

extensionListshould 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 Source

AllowedExtensions

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 Source

IsAllowedExtension(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.

| Improve this Doc View Source

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.

| Improve this Doc View Source

RestrictBy(FileExtensionWhitelist)

Declaration
public FileExtensionWhitelist RestrictBy(FileExtensionWhitelist parentList)
Parameters
Type Name Description
FileExtensionWhitelist parentList
Returns
Type Description
FileExtensionWhitelist
| Improve this Doc View Source

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.

| Improve this Doc View Source

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

additionalExtensionscase and '.' prefix will be corrected, and duplicates will be excluded from the string.

| Improve this Doc View Source

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.

| Improve this Doc View Source

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

additionalExtensionscase and '.' prefix will be corrected, and duplicates will be excluded from the string.

| Improve this Doc View Source

ToString()

Declaration
public override string ToString()
Returns
Type Description
System.String

Extension Methods

JsonExtensionsWeb.ToJson(Object)
  • View Source
Back to top by the community, for the community... #DNNCMS