error with Security Exception

Posted by Alexander on Stack Overflow See other posts from Stack Overflow or by Alexander
Published on 2010-04-10T05:30:19Z Indexed on 2010/04/10 5:33 UTC
Read the original article Hit count: 401

Filed under:
|

I am getting the following error on my page:

Security Exception Description: The application attempted to perform an operation not allowed by the security policy. To grant this application the required permission please contact your system administrator or change the application's trust level in the configuration file.

The problem is with the following code

SmtpClient mailClient = new SmtpClient("smtp.gmail.com", 587);

What's weird is that when testing it at my localhost, everything works fine, but when I put it on my 1and1 web host it generates the error above. I contacted their support and here's their answer.

We do check the error logs and the operation require a FullTrust environment which currently fall under restriction on .NET Framewor

k

What should I do?

© Stack Overflow or respective owner

Related posts about ASP.NET

Related posts about .NET