登录尝试后GoDaddy上的另一个安全例外

时间:2008-11-20 08:11:14

标签: asp.net security exception

主持人:GoDaddy共享主机

信任等级:中等

我提交有效的用户/通行证后会发生以下情况。数据库具有读/写权限,当我删除管理页面上的登录要求时,会按预期更新数据库。

有没有其他人有这个问题或知道问题是什么? 任何人吗?

Server Error in '/' 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.Security.Permissions.FileIOPermission, mscorlib, Version=2.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.

Stack Trace:

[SecurityException: Request for the permission of type 'System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.]
   System.Security.CodeAccessSecurityEngine.Check(Object demand, StackCrawlMark& stackMark, Boolean isPermSet) +0
   System.Security.CodeAccessPermission.Demand() +59
   System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy) +684
   System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share) +114
   System.Configuration.Internal.InternalConfigHost.StaticOpenStreamForRead(String streamName) +80
   System.Configuration.Internal.InternalConfigHost.System.Configuration.Internal.IInternalConfigHost.OpenStreamForRead(String streamName, Boolean assertPermissions) +115
   System.Configuration.Internal.InternalConfigHost.System.Configuration.Internal.IInternalConfigHost.OpenStreamForRead(String streamName) +7
   System.Configuration.Internal.DelegatingConfigHost.OpenStreamForRead(String streamName) +10
   System.Configuration.UpdateConfigHost.OpenStreamForRead(String streamName) +42
   System.Configuration.BaseConfigurationRecord.InitConfigFromFile() +437


Version Information: Microsoft .NET Framework Version:2.0.50727.1433; ASP.NET Version:2.0.50727.1433 

4 个答案:

答案 0 :(得分:10)

http://www.codeproject.com/Questions/586223/SecurityplusExceptionpluscomingplusinplusaplusrunn

解决方案4 System.Security.SecurityException:请求类型'System.Net.SocketPermission,System,Version = 4.0.0.0,Culture = neutral,PublicKeyToken = b77a5c561934e089'的权限失败

以下解决上述错误

<system.web>
    <customErrors mode="Off"/>
    <trust level="Full" />
</system.web>

适用于我的教父

答案 1 :(得分:1)

您是否尝试过使用网站中文件和文件夹的权限?我在godaddy上有一个错误,因为该目录没有写入权限,因此无法写入新文件。您可以尝试将整个根设置为读/写,以查看是否可以解决您的问题。要获得权限设置:

  • 登录GoDaddy
  • 点击您网站名称旁边的“我的托管帐户”和“管理帐户”
  • 点击“我的文件”
  • 选中要访问的文件旁边的框,然后点击顶部的权限图标

答案 2 :(得分:1)

如果您正在使用任何第三方组件,则可能需要检查组件是否正在执行某种类型的安全操作。大约一年前,我遇到了GoDaddy和SubSonic ORM的问题,它遇到了一个特殊的代码行问题,它要求一定程度的安全性。我破解了反射器中的代码,看了看,验证了它。

这可能是个问题。如果组件 导致您痛苦,请尝试下载代码并删除可疑代码,重新编译并运行该代码。这正是我一年或两年后用SubSonic代码所做的事情。

答案 3 :(得分:1)

我目前正在将我的网站移至GoDaddy并点击此错误。我有一个自定义成员资格提供程序,它使用基于web.config中的machinekey的散列密码。所以正是这段代码导致了错误:

// Get encryption and decryption key information from the configuration.
Configuration cfg =
  WebConfigurationManager.OpenWebConfiguration(System.Web.Hosting.HostingEnvironment.ApplicationVirtualPath);
machineKey = (MachineKeySection)cfg.GetSection("system.web/machineKey");

if (machineKey.ValidationKey.Contains("AutoGenerate"))
    if (PasswordFormat != MembershipPasswordFormat.Clear)
        throw new ProviderException("Hashed or Encrypted passwords are not supported with auto-generated keys.");

所以问题是尝试使用WebConfigurationManager.OpenWebConfiguration打开web.config,我通过使用以下内容替换OpenWebConfiguration和GetSection行来修复:

machineKey = (MachineKeySection)WebConfigurationManager.GetWebApplicationSection("system.web/machineKey");