我已经为网址加密准备好了HttpModule;我注意到这个模块也在拦截MVC bundle请求;即使我使用的是以下设置:
<modules runAllManagedModulesForAllRequests="false">
<add ..preCondition="managedHandler" />
</modules>有没有办法绕过拦截来自HttpModule的MVC bundle请求?
发布于 2015-07-08 19:32:09
因此,要忽略httpmodule中的某些路由,您可以使用Application_BeginRequest或Application_EndRequest,如下面的示例所示,忽略aspx页面或检查您想要忽略的路径
示例:
private void Application_BeginRequest(Object source, EventArgs e)
{
HttpApplication application = (HttpApplication)source;
HttpContext context = application.Context;
string filePath = context.Request.FilePath;
string fileExtension = VirtualPathUtility.GetExtension(filePath);
if (fileExtension.Equals(".aspx"))
{
return;
}
}但是,如果您的功能与应用程序的某些模块相关,我建议您使用Filters(特定于MVC,用于模块)而不是HttpModules(特定于整个应用程序)。
https://stackoverflow.com/questions/31291239
复制相似问题