【问题标题】:Security error in ASP NET shared accountASP NET 共享帐户中的安全错误
【发布时间】:2023-03-11 20:36:02
【问题描述】:

这些行会导致 godaddy 帐户中的安全异常。有什么建议如何重写以使其正常工作?

File.Delete(PropsFileName);     // Clean up

TextWriter tw = new StreamWriter(PropsFileName);    // Create & open the file
tw.WriteLine(DateTime.Now);     // Write the date for reference
tw.WriteLine(TokenLine);        // Write the BinarySecurityToken
tw.WriteLine(ConvIdLine);       // Write the ConversationId
tw.WriteLine(ipccLine);     // Write the IPCC
tw.Close();

谢谢!

正在将信息写入临时目录中的 session.properties 变量。

【问题讨论】:

    标签: c# .net asp.net .net-3.5


    【解决方案1】:

    GoDaddy 设置为在中等信任下运行,要在 localhost 上模拟此操作,请将以下内容添加到您的 web.config:

    <system.web>
        <trust level="Medium" />
    </system.web>
    

    您可以尝试解决问题的方法是将以下内容添加到您的 AssemblyInfo.cs 下的 Project > Properties in solution explorer

    [assembly: AllowPartiallyTrustedCallers]
    

    还有一篇文章可能会或可能不会帮助您和/或让您深入了解 NHibernate 的类似情况:NHibernate in a Medium Trust Environment

    【讨论】:

      【解决方案2】:

      您应该向运行 ASP.NET 应用程序的用户授予 NTFS 权限。您的主机控制面板可能支持为文件夹分配 NTFS 权限。

      【讨论】:

        猜你喜欢
        • 2011-07-16
        • 2016-03-23
        • 2016-12-05
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2019-08-17
        • 2018-12-20
        • 2016-07-28
        相关资源
        最近更新 更多