如何从AJAX调用中识别IHttpModule中的Webservice [英] How to identify Webservice in IHttpModule from an AJAX call

查看:102
本文介绍了如何从AJAX调用中识别IHttpModule中的Webservice的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我正在为我的客户开发一个安全模块,我遇到了问题(尝试)解决。而且我想知道是否有人可以帮助我。

这是我的环境。我写了一个IHttpModule并在PreRequestHandleExecute事件中捕获Context.Handler以检查一些信息,例如,如果处理程序是Page I检查一些祖先和接口,然后我检索我需要的信息。 - 见下面的代码---

...

HttpApplication theApp =( HttpApplication )发件人;

HttpApplication theApp = (HttpApplication )sender;

...

if (theApp.Context.Handler System.Web .UI。 Page

if (theApp.Context.Handler is System.Web.UI.Page )

{

/ * - >检索页面* /

Page myPage = theApp.Context .Handler as Page ;

Page myPage = theApp.Context.Handler as Page ;

/ * - >检索类型* /

类型 thePage = myPage.GetType();

/ * - >检索接口* /

类型 [] interfaces = thePage.GetInterfaces();

/ * - >检查接口* /

如果 (!FindForISoxUIInterfaces (接口, typeof ISoxUIPage ))){...抛出异常()...}

if (!FindForISoxUIInterfaces(interfaces, typeof (ISoxUIPage ))){ ... throw exception() ... }

/ * - >检查Ancestors * /

如果 (!FindForSoxBaseClass (thePage, typeof BasePage ))){... throw exception()...}

if (!FindForSoxBaseClass(thePage, typeof (BasePage ))) { ... throw exception() ... }

...

}

...

此代码工作正常。我的问题是当我收到WebService请求(通过AJAX)。在这种情况下,我不知道如何检索webservice类来检查一些模式。在Context.Handler中,我总是看到 System.Web.Script.Services.ScriptHandlerFactory.HandlerWrapper。 我尝试了一些反思,看了一下调用堆栈(在ws中),在调试器窗口看了几乎所有分支,用.Net查看了程序集反射器,但没有成功。

如果有人可以帮助我....

IF someone can help me....

推荐答案

好问题!
good question!


这篇关于如何从AJAX调用中识别IHttpModule中的Webservice的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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