Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/277.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# Spile安全策略失败,因为对Spile.axd的请求不';不显示当前用户_C#_Asp.net_Sitecore_Glimpse - Fatal编程技术网

C# Spile安全策略失败,因为对Spile.axd的请求不';不显示当前用户

C# Spile安全策略失败,因为对Spile.axd的请求不';不显示当前用户,c#,asp.net,sitecore,glimpse,C#,Asp.net,Sitecore,Glimpse,我在Sitecore 8.1环境中的安装有问题。我正在尝试创建一个简单的安全策略来检查当前用户是否是Sitecore管理员 if (!Sitecore.Context.User.IsAdministrator) { return RuntimePolicy.Off; } 这在功能上与通过NuGet安装时提供的示例代码中给出的示例相同,即 var httpContext = policyContext.Get

我在Sitecore 8.1环境中的安装有问题。我正在尝试创建一个简单的安全策略来检查当前用户是否是Sitecore管理员

        if (!Sitecore.Context.User.IsAdministrator)
        {
            return RuntimePolicy.Off;
        }
这在功能上与通过NuGet安装时提供的示例代码中给出的示例相同,即

        var httpContext = policyContext.GetHttpContext();
        if (!httpContext.User.IsInRole("Administrator"))
        {
            return RuntimePolicy.Off;
        }
问题是,当点击此代码时,请求被定向到scape.axd,用户总是被重置为extranet\Anonymous。当没有匿名用户时,Sitecore始终设置匿名用户。任何不属于该处理程序的请求都会通过检查并设置RuntimePolicy.On

我在web.config中有以下内容

<modules runAllManagedModulesForAllRequests="true">
  <remove name="WebDAVModule"/>
  <add type="Sitecore.Web.RewriteModule, Sitecore.Kernel" name="SitecoreRewriteModule"/>
  <add name="Glimpse" type="Glimpse.AspNet.HttpModule, Glimpse.AspNet" preCondition="integratedMode"/>
  <add type="Sitecore.Nexus.Web.HttpModule,Sitecore.Nexus" name="SitecoreHttpModule"/>
  <add type="Sitecore.Resources.Media.UploadWatcher, Sitecore.Kernel" name="SitecoreUploadWatcher"/>
  <add type="Sitecore.IO.XslWatcher, Sitecore.Kernel" name="SitecoreXslWatcher"/>
  <add type="Sitecore.IO.LayoutWatcher, Sitecore.Kernel" name="SitecoreLayoutWatcher"/>
  <add type="Sitecore.Configuration.ConfigWatcher, Sitecore.Kernel" name="SitecoreConfigWatcher"/>
  <remove name="Session"/>
  <add name="Session" type="System.Web.SessionState.SessionStateModule" preCondition=""/>
  <add type="Sitecore.Analytics.RobotDetection.Media.MediaRequestSessionModule, Sitecore.Analytics.RobotDetection" name="MediaRequestSessionModule"/>
  <add type="Sitecore.Web.HttpModule,Sitecore.Kernel" name="SitecoreHttpModuleExtensions"/>
  <add name="SitecoreAntiCSRF" type="Sitecore.Security.AntiCsrf.SitecoreAntiCsrfModule, Sitecore.Security.AntiCsrf"/>
</modules>


问题是,为什么用于/scape.axd的请求没有将与请求相同的身份验证cookie传递给站点的其他部分?

我希望能为您提供更多帮助,但这似乎更像是一个Sitecore问题,而不是一个scape问题:(是的,我认为这与Sitecore有更多的关系。奇怪的是,Sitecore的身份验证依赖于ASP.NET身份验证,所以所有的cookie都是相同的。我不明白为什么对Skille.axd的请求会有一组不同于对页面的请求的cookie。当在Siteco中对我的Web服务进行AJAX调用时重新定位所有cookie与请求页面的cookie相同。