Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/272.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/asp.net/35.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# 以编程方式加载或排除system.webServer模块_C#_Asp.net_Module - Fatal编程技术网

C# 以编程方式加载或排除system.webServer模块

C# 以编程方式加载或排除system.webServer模块,c#,asp.net,module,C#,Asp.net,Module,我开发了一个利用第三方DLL的网站 此DLL已声明名为AgeGatewayModule的IHttpModule类 我没有访问DLL源代码的权限 在我的web.config中,我在配置属性中声明了一个configSection&feed: <configSections> <section name="AgeGatewayConfiguration" type="ExternalCompany.AgeGateway.SDK.AgeGatewayConfiguration" /&g

我开发了一个利用第三方DLL的网站

此DLL已声明名为AgeGatewayModule的IHttpModule类

我没有访问DLL源代码的权限

在我的web.config中,我在配置属性中声明了一个configSection&feed:

<configSections>
<section name="AgeGatewayConfiguration" type="ExternalCompany.AgeGateway.SDK.AgeGatewayConfiguration" />
</configSections>

<AgeGatewayConfiguration
  AgeGatewayUrl="~/Age-Gateway/"
  AccessDeniedUrl="~/Access-Denied/"
  CountryServiceUrl="http://External-Company.svc/v1/" 
LocationServiceUrl="http://External-Company.svc/v1/" 
LdaServiceUrl="http://External-Company.svc/v1/" 
WhiteListingUserAgentsServiceUrl="http://External-Company.svc/v1/UserAgents/" 
WhiteListingReferrersServiceUrl="http://External-Company.svc/v1/Referrers/" 
TokenRealm="http://External-Company.com" 
TokenUserId="xxxx" 
TokenPassword="xxxxxx" 
TokenServiceNamespace="xxxxx" 
TokenAcsHostUrl="accesscontrol.windows.net" 
AllowedGreyCountriesToGlobal="AL" />
他们将被豁免填写年龄网关表。i、 e.不会发生重定向

web.config中添加的AgeGatewayModule在后台执行所有检查,并在必要时重定向到age网关url

所以我想说的是:

if(url != "http://my-website/admin/" || CurrentLoggedInUser != admin)
{
//load the AgeGatewayModule only now)
}

这可能吗?

不是解决方案,但可能很有趣,谢谢@MennanKara-很有趣-但似乎解决方案面向MVC,而不是webforms。我的代码在System.Web.Infrastructure.DynamicModuleHelper.DynamicModuleUtility.RegisterModule的基础结构上中断并引发命名空间错误。我以前一直在寻找将HttpModule限制到某些路径的解决方案,但运气不好。如果您找到了解决方案,请与我们分享,谢谢。@MennanKara-仍在寻找-还没有其他回复。如果我发现什么,我会告诉你的。现在看起来不太好。。谢谢,实际上,您可以在自己的类中包装第三方模块类,并在代码中为类添加路径限制,您认为如何?
 http://my-website/admin/
if(url != "http://my-website/admin/" || CurrentLoggedInUser != admin)
{
//load the AgeGatewayModule only now)
}