How to make your FTP, SFTP, and Mail components work on ASP.NET web servers with "Medium Trust" environment configuration

 

Overview

The “trust level” refers to permissions set in the Web.config file that dictate what operations can and cannot be performed by web applications. Many web hosting providers' servers use the default Medium Trust level with the addition of ReflectionPermission and SocketPermission as detailed below:

  • SocketPermission Unrestricted="true"
  • ReflectionPermission Unrestricted="true"

Using a Medium Trust level prevents applications from accessing shared system resources and eliminates the potential for application interference. Adding SocketPermission allows better access to networking services. Adding ReflectionPermission allows access to non-public types and members.

Applications operating under a Medium Trust level have no registry access and no access to the Windows event log. Both network and file system access will be limited.

How to make my FTP, SFTP, and Mail components work on ASP.NET web servers with 'Medium Trust' level

The ultimate components including FTP, SFTP, and Mail work normally on ASP.NET web servers using the default Medium Trust level with the addition of ReflectionPermission and SocketPermission. To make them work, add the following line of code at the beginning of your web application:

C#

ComponentPro.Security.SecuritySettings.MediumTrust = true;

VB.NET

ComponentPro.Security.SecuritySettings.MediumTrust = True

To make it convenient for you, we have included some ASP.NET Web Samples to our setup packages as listed below:

  • Ultimate FTP: MediumTrustWebDemo and MediumTrustWebDemoVB
  • Ultimate SFTP: SftpMediumTrustWebDemo and SftpMediumTrustWebDemoVB
  • Ultimate POP3: Pop3MediumTrustWebDemo and Pop3MediumTrustWebDemoVB
  • Ultimate IMAP: ImapMediumTrustWebDemo and ImapMediumTrustWebDemoVB
  • Ultimate SMTP: SmtpMediumTrustWebDemo and SmtpMediumTrustWebDemoVB

45-Day Money Back Guarantee

We will refund your full money in 45 days
if you are not satisfied with our products

Buy Now

Dont miss out Get update on new articles and other opportunities