ASP Web服务:检查用户是否已登录 [英] asp web service: check if user is logged-in

查看:169
本文介绍了ASP Web服务:检查用户是否已登录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在创建一个Web服务,该服务将从asp.net中的Web表单中调用. Web服务如何检查用户是否已登录以及实际是在请求服务的登录用户?

I'm creating a web service that'll be called from a web form in asp.net. How does the web service check if the user is logged-in and if it is the logged-in user that's actually requesting the service?

谢谢

推荐答案

不能.由于您要从ASP.NET调用Web服务,因此您正在构建一个三层应用程序.

It cannot. Since you're going to call the web service from ASP.NET, you're building a 3-tier application.

第1层是浏览器,第2层是ASP.NET Web应用程序.它们共享cookie和会话变量,因此ASP.NET可以始终对用户进行身份验证.而且您已经知道了.

Tier 1 is the browser and tier 2 is ASP.NET web application. They share cookies and session variables, so ASP.NET can always authenticate the user. And you already know that.

第3层是Web服务. 2和3之间的通信是通过不同的HTTP连接进行的,共享不同的cookie(实际上没有)和会话变量(同样,因为调用是无状态的,因此实际上没有).

Tier 3 is the web service. Communication between 2 and 3 is done over a different HTTP connection, sharing different cookies (actually none) and session variables (again, actually none because calls are stateless).

然后,您将无法允许第3层上的Web服务对第1层上的客户端进行身份验证.

You then have no way to allow the web service on tier 3 to authenticate the client on tier 1.

如何……

仍有可能,但前提是您的Web服务对于ASP.NET Web应用程序是本地.实际上,这不太可能发生,因为Web服务是为远程呼叫而不是本地呼叫而进行的.我不认为这是您的情况.

There is still a possibility, but only if your web service is local to your ASP.NET webapp. That's unlikely to occur, really, because web services are made for remote calls, not local calls. I don't think it's your case.

这篇关于ASP Web服务:检查用户是否已登录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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