1

Hi I met the following problem when achieve a function "send an email to members" in my membership application. I did some research and add

             <system.web>
             <securityPolicy>
                <trustLevel name="Full" policyFile="internal"/>
             </securityPolicy>
            </system.web> 

to my Web.config, then deployed to server again, but the problem still exists. Any ideas? Thanks in advance.

   Server Error in '/TestApp' Application.

   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. 

   Exception Details: System.Security.SecurityException: Request for the permission of type 'System.Net.Mail.SmtpPermission, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.

   Source Error: 

   An unhandled exception was generated during the execution of the current web request. Information  regarding the origin and location of the exception can be identified using the exception stack trace below.
1
  • That seems like how you are supposed to fix this... dumb question, but are you setting it anywhere else in your web.config? Only thing I can think is that you are overwriting it. Commented Aug 1, 2013 at 15:05

1 Answer 1

1

When sending the email you might be specifying the SMTP port number which might not be allowed.

Here is an example of what I'm talking about: SecurityException: Request for the permission of type 'System.Net.Mail.SmtpPermission'

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.