本文介绍了如何覆盖WCF以返回状态码401(未授权)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何拦截对我的数据服务(* .svc文件)的调用以注入我自己的逻辑,该逻辑将检查用户当前是否在其asp会话中进行身份验证仍处于活动状态? 当我检测到这种情况时,计划返回一个401代码,以便我的ajax库做出适当的反应。
我知道如何查询会话并设置适当的标题但是我不知道如何挂钩到WCF数据服务处理管道。
谢谢
标记
解决方案我希望以下文章可以提供帮助: blogs.msdn/b/astoriateam/archive/2010/07/19/odata-and-authentication-part-4-server-侧hooks.aspx
How can I intercept a call to my data service (*.svc file) to inject my own logic that would check to see if the user is currently authenticated in their asp session is still active? When I detect this situation plan to return a 401 code so that my ajax library reacts appropriately.
I know how to interrogate the session and set the appropriate headers but I don't know how to hook into the WCF Data Services processing pipeline.
Thanks
Mark
解决方案 I hope the following article should help:blogs.msdn/b/astoriateam/archive/2010/07/19/odata-and-authentication-part-4-server-side-hooks.aspx更多推荐
如何覆盖WCF以返回状态码401(未授权)
发布评论