문제

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.
도움이 되었습니까?

해결책

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'

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top