维持在Silverlight会议 [英] Maintaining session in Silverlight

查看:132
本文介绍了维持在Silverlight会议的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创造与WCF连接一个Silverlight。我想创建和维护在Silverlight用户登录后的会话,并做到以下几点。

I am creating a Silverlight with WCF connectivity. I would like to create and maintain a session after user login in Silverlight and do the following.


  • 在成功登录,创建一个会话对象,存储会话ID,用户ID,用户名,会话状态

  • 在与WCF还呼吁,会话信息需要从Silverlight的传递到WCF

一个解决方案是创建一个会话对象,并把它作为参数的所有方法。

One solution would be to create a session object and pass it as parameter to all methods.

有没有传递的所有Web服务调用的信息没有通过一个成员变量的任何其他方式?

Is there any other way of passing the info in all web service calls without passing a member variable?

类似的事情在ASP.NET持久性会话对象。

Something similar to persistent Session object in ASP.NET.

推荐答案

为什么要每次传递会话信息?

Why would you want to pass the session information each time?

如果您正在使用ASP.NET来托管在ASP兼容模式下WCF服务,你可以设置instanciation模式会议,那么所有存储在你的WCF服务的实例变量。或者在你的ASP会话对象。

If you're using ASP.NET to host your WCF service in ASP compatibility mode, you can set the instanciation mode to Session to then store all that in your WCF service instance variables. Or in your ASP session object.

我不明白你的意思是将所有这些数据为每个请求的东西。

I can't see what your point is in sending all this data for each request.

一个很好的做事情用SL采用ASP.NET当使用ASP.NET内置的身份验证的就像这里,然后你可以调用WCF服务,并检查 HttpContext.Current.User.Identity .IsAuthenticated 是真实的。

A good thing to do when using SL with ASP.NET is to login using the ASP.NET built-in authentication Like here and then you can just call the WCF service and check that HttpContext.Current.User.Identity.IsAuthenticated is true.

这篇关于维持在Silverlight会议的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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