error with Security Exception
- by Alexander
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?