【问题标题】:Security Exception in MVC3MVC3 中的安全异常
【发布时间】:2013-08-01 14:56:21
【问题描述】:

您好,我在会员申请中实现“向会员发送电子邮件”功能时遇到了以下问题。我做了一些研究并添加了

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

到我的Web.config,然后再次部署到服务器,但问题仍然存在。有任何想法吗?提前致谢。

   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.

【问题讨论】:

  • 这似乎是你应该如何解决这个问题......愚蠢的问题,但你是否在 web.config 中的其他任何地方设置它?我唯一能想到的是你正在覆盖它。

标签: asp.net-mvc-3 security code-access-security asp.net-mvc-3-areas


【解决方案1】:

发送电子邮件时,您可能指定了不允许使用的 SMTP 端口号。

下面是我所说的一个例子: SecurityException: Request for the permission of type 'System.Net.Mail.SmtpPermission'

【讨论】:

    猜你喜欢
    • 2016-06-16
    • 1970-01-01
    • 2011-03-09
    • 2010-11-29
    • 1970-01-01
    • 2012-02-25
    • 1970-01-01
    • 2010-12-02
    • 2016-11-20
    相关资源
    最近更新 更多