简体   繁体   English

与Jquery控件一起使用时的Asp.Net Web服务安全性

[英]Asp.Net web service security while using with Jquery controls

http://jquery.com/ provides great controls. http://jquery.com/提供了出色的控件。 And also there are many other opensource control based on Jquery. 并且还有许多其他基于Jquery的开源控件。 But now control like Auto-complete , one need to use web service to get data and bind with control using jquery. 但是现在像Auto-complete这样的控件需要使用Web服务获取数据并使用jquery与控件绑定。 I am able to bind data successfully. 我能够成功绑定数据。 But now I want that, only authenticate user can see or use that data. 但是现在我想要的是,只有经过身份验证的用户才能看到或使用该数据。 Its quite possible using network credential class, but that is only when I am writing server side code or we can say consuming service at server side or using it in windows application. 使用网络凭证类是完全有可能的,但这仅是在我编写服务器端代码时,或者我们可以说在服务器端使用服务或在Windows应用程序中使用它时。 But I don't know how to do this with JavaScript / Jquery. 但是我不知道如何用JavaScript / Jquery做到这一点。 In Asp.Net MVC it is a functionality to POST data, but I don't know if we have anything like this in Asp.Net web forms(.net 4.0). 在Asp.Net MVC中,它具有POST数据的功能,但是我不知道在Asp.Net Web表单(.net 4.0)中是否有类似的功能。

Please help me out with this. 这个你能帮我吗。 Example or sample code will be highly appreciable. 示例或示例代码将非常有价值。

Thanks in advance. 提前致谢。

The auto complete (or similar) is making a call to handler that is running under your domain so all the things that are available to in any other page (session, cookie, context) are also available in your handler so you can simply check if the user is authenticated in you handler and decide what to do if he isn't. 自动完成功能(或类似功能)正在调用在您的域下运行的处理程序,因此其他任何页面中可用的所有内容(会话,Cookie,上下文)也都可以在处理程序中使用,因此您可以简单地检查是否用户在您的处理程序中通过了身份验证,并决定是否进行该操作。 In Web Method you can access the session like this: (HttpContext.Current.Session) 在Web方法中,您可以像这样访问会话: (HttpContext.Current.Session)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM