ASP.NET模拟在.NETFramework 2 VS .NETFrameWork 4 [英] ASP.NET Impersonate in .NETFramework 2 VS .NETFrameWork 4

查看:306
本文介绍了ASP.NET模拟在.NETFramework 2 VS .NETFrameWork 4的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们有一个ASP.NET网站在.NetFramework 2(与应用程序池2 Classic在IIS 7.5),我们使用混合身份验证基本身份验证表单身份验证

We have an ASP.NET Site in .NetFramework 2 (with App Pool 2 Classic in IIS 7.5), We use mixed Authentication with Basic Authenticate and Form Authenticate.

在IIS的配置:

和有特定的用户在匿名身份验证命名为:访客

And have specific user in Anonymous Authentication named: Guest.

在与像管理​​我们用模拟其他用户名,用户登录:

When The user Login with another username like Admin we use impersonate:

string Token = GetSpecificTokenOfCurrentUser();
System.Security.Principal.WindowsIdentity WinUser = (WindowsIdentity) HttpContext.Current.Application["User_"+Token];
WinUser.Impersonate();

所以,每一件事情是完美的,直到我们升级网站.NetFramework 4和.NET 4中增添了许多功能的网站,我们想通,我们有一个新的问题。

So every thing is perfect until we upgrade website to .NetFramework 4 and add a lot of features in .NET 4 to website, and we figured we have a new Problem.

问题是与管理​​用户登录和打开一些网页(3-4)都聚集在同一时间,想在新标签迅速打开,用户不要模拟在某些情况下。像第一页正确模拟到管理​​,但另一个页面没有模拟,而且还有访客用户。

The problem is the user login with Admin And open some pages (3-4) all together in same time, like quickly opened in new tab, the User Not impersonated in some cases. Like the first page impersonated correctly to Admin but another pages not impersonated and still have Guest User.

这是太奇怪了,我们没有在认证部分的任何变化。变化是我们升级到.NetFrameWork 4和应用程序池是.NetFrameWork 4 - 经典

This is so weird, we don't have any changes in Authentication Part. the changes is we upgrade to .NetFrameWork 4 and App Pool is .NetFrameWork 4 - Classic.

我们有净2版本的网站测试。每一件事情是确定的,但是我们改变了应用程序池,以.NetFrameWork 4,并证明这个问题。

We have a test in .Net 2 Version Of Website. every thing is OK, but we change the App Pool to .NetFrameWork 4 and the problem was shown.

所以,问题是什么样的变化.NetFramework 4发生应用程序池来冒充?

So The question is what changes happened in .NetFramework 4 App Pool to Impersonate?

有我们错过了什么事?任何建议?

Is there any thing we missed? any suggestion?

推荐答案

我发现的一些要点:

1的多请求的行为类似于并行处理,并作为您在经典模式知道我们有并行一定的局限性。

1- The Multi-Request behaves like Parallel processing, and as you know in classic mode we have some limitations with parallelism.

2 - 在集成模式中,我们在冒充一些限制启用。启用模拟的默认行为是500.24错误:内部服务器错误的ASP.NET设置已检测到不适用于综合管理的管道模式如果我们想要让我们冒充需要添加<验证validateIntegratedModeConfiguration =FALSE/> < system.webServer> 在网页。配置,所以我们没有得到的错误,但钢铁,我们有另一个限制。该命令冒充不是在 Begin_Request 工作,并在的AuthenticateRequest 方法,什么都完美。

2- In Integrated mode we have some limitations in Impersonate Enable. The default behavior of Enable Impersonate is 500.24 Error: Internal Server Error An ASP.NET setting has been detected that does not apply in Integrated managed pipeline mode" if we want enable impersonate we need to add <validation validateIntegratedModeConfiguration="false"/> to <system.webServer> in web.config, So we don't get the error, but steel we have another limitation. The impersonate commands not worked in Begin_RequestAnd in AuthenticateRequest Methods, anything else worked perfectly.

的<一个href=\"http://mvolo.com/breaking-changes-for-aspnet-20-applications-running-in-integrated-mode-on-iis-70/\"相对=nofollow>重大更改为ASP.NET 2.0 IIS 7.0上在集成模式下运行的应用程序是在这种情况下很好的文章。

The Breaking Changes for ASP.NET 2.0 applications running in Integrated mode on IIS 7.0 is very good article in this case.

因此​​,解决方案是

移动到集成模式(需要添加标签),并使用假冒任何其它的方法,而不是 Begin_Request 的AuthenticateRequest

Move to Integrated mode (Need Add tag) And Use Impersonate in any other methods instead of Begin_Request or AuthenticateRequest.

这篇关于ASP.NET模拟在.NETFramework 2 VS .NETFrameWork 4的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆