如何覆盖WCF以返回状态码401(未授权)

编程入门 行业动态 更新时间:2024-10-20 07:39:33
本文介绍了如何覆盖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(未授权)

本文发布于:2023-11-17 12:11:02,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1609958.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:状态   WCF

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!