【发布时间】:2014-05-15 08:34:58
【问题描述】:
我刚刚开始为我的移动应用程序创建 WCF 服务。目前我在单一解决方案中有多个项目。
- 主要网站项目
- Edmx 项目
- WCF 库项目
认证功能
public List<AuthenticateModel> Authenticate(string UserName, string Password)
{
SimpleMembershipInitializer _initialized = new SimpleMembershipInitializer();
bool validate = System.Web.Security.Membership.ValidateUser(UserName, Password);
AuthenticateModel model = new AuthenticateModel();
if (validate)
{
model.userID = IDUser
}
Return model;
}
现在我怎么知道同一个登录用户正在调用另一个函数。如果这里有什么方法可以将会话保持为网络?或者传递任何证书或令牌进行验证(如果是如何传递令牌并实现它)?
[OperationContract]
[WebInvoke(UriTemplate = "GetAllrecords/?paramId={paramId}", Method = "GET", ResponseFormat = WebMessageFormat.Json, RequestFormat = WebMessageFormat.Json, BodyStyle = WebMessageBodyStyle.Wrapped)]
List<SomeModel> GetAllrecords(int paramId)
{
Return something; // Return requested data
}
任何帮助将不胜感激。
【问题讨论】:
标签: asp.net-mvc wcf wcf-security