分享

写回答

发帖

[提问] Security Exception Godaddy主机 不知道怎么解决

GoDaddy GoDaddy 1864 人阅读 | 7 人回复

发表于 2010-9-7 09:06:55 | 显示全部楼层 |阅读模式

2010-09-07_090519.png
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.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.

Source Error:

The source code that generated this unhandled exception can only be shown when compiled in debug mode. To enable this, please follow one of the below steps, then request the URL:

1. Add a "Debug=true" directive at the top of the file that generated the error. Example:

  <%@ Page Language="C#" Debug="true" %>

or:

2) Add the following section to the configuration file of your application:

<configuration>
   <system.web>
       <compilation debug="true"/>
   </system.web>
</configuration>

Note that this second technique will cause all files within a given application to be compiled in debug mode. The first technique will cause only that particular file to be compiled in debug mode.

Important: Running applications in debug mode does incur a memory/performance overhead. You should make sure that an application has debugging disabled before deploying into production scenario.

Stack Trace:

[SecurityException: Request for the permission of type 'System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.]
   System.Security.CodeAccessSecurityEngine.SpecialDemand(PermissionType whatPermission, StackCrawlMark& stackMark) +0
   System.Security.CodeAccessPermission.DemandInternal(PermissionType permissionType) +23
   System.Runtime.Serialization.Formatters.Binary.ObjectWriter.Serialize(Object graph, Header[] inHeaders, __BinaryWriter serWriter, Boolean fCheck) +60
   System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Serialize(Stream serializationStream, Object graph, Header[] headers, Boolean fCheck) +134
   Serialize.Encrypt(T t) +59
   Signin.btnLogin_Click(Object sender, EventArgs e) +164
   System.EventHandler.Invoke(Object sender, EventArgs e) +0
   System.Web.UI.WebControls.Button.OnClick(EventArgs e) +111
   System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +110
   System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +10
   System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13
   System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +36
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +6785
   System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +242
   System.Web.UI.Page.ProcessRequest() +80
   System.Web.UI.Page.ProcessRequestWithNoAssert(HttpContext context) +21
   System.Web.UI.Page.ProcessRequest(HttpContext context) +49
   ASP.signin_aspx.ProcessRequest(HttpContext context) +4
   System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +181
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +75

回答|共 7 个

sqzyst

发表于 2010-9-7 09:08:30 | 显示全部楼层

我用到的是 form 验证,里面 也有Global.asax

Global.asax 里面的内容如下:
protected void Application_AuthenticateRequest(object sender,EventArgs e)
    {
        if (this.Context.User != null)
        {
            if (this.Context.User.Identity.IsAuthenticated)
            {
                if (this.Context.User.Identity is FormsIdentity)
                {
                    string strUser = ((FormsIdentity)this.Context.User.Identity).Ticket.UserData;
                    string[] roles = Serialize.Decrypt<UserInfo>(strUser).Roles.Split(',');
                    this.Context.User = new GenericPrincipal(this.Context.User.Identity, roles);
                }
            }
        }
    }
RAKSmart

sqzyst

发表于 2010-9-7 09:11:34 | 显示全部楼层

还用到 序列化 本地正常 传到Godaddy 主机上出错

[Serializable]
public class UserInfo
{
    private int id;

    public int Id
    {
        get { return id; }
        set { id = value; }
    }
    private string name;

    public string Name
    {
        get { return name; }
        set { name = value; }
    }
    private string roles;

    public string Roles
    {
        get { return roles; }
        set { roles = value; }
    }
        public UserInfo()
        {
        }
}

sqzyst

发表于 2010-9-7 09:12:42 | 显示全部楼层

我说的出错 不是 上面的代码出错 是测试站点

期待高手  给予帮助,解决此问题,表示诚挚的敬意!

sqzyst

发表于 2010-9-7 09:14:42 | 显示全部楼层

网址:www.aoccy.info

用户名、密码都是:suntao    我测试用的小程序  原来我做的一个站  就是 form 验证这一块老是有毛病,昨天  又做了一个站,单独  将form 验证这一块  取出来  放到godaddy上测试,果然不出所料,又出错了。

add.c

发表于 2010-9-7 09:22:23 | 显示全部楼层

GoDaddy虚拟主机.net  2.0是中等安全信任等级(medium trust), 而有些asp.net程序需要full trust所以安装出错,
还有些组件可以在asp和asp.net1.1中支持,但是在asp.net2.0/3.0/3.5中不能支持,
详细:http://bbs.idcspy.com/thread-64066-1-1.html

sqzyst

发表于 2010-9-7 09:29:10 | 显示全部楼层

谢谢版主,反馈真及时,非常感谢您的帮助

祝你生活快乐!

add.c

发表于 2010-9-7 10:22:15 | 显示全部楼层

回复 7# 的帖子

能帮助到你就好
您需要登录后才可以回帖 登录 | 注册

本版积分规则