在Silverlight应用程序中进行会话? [英] Session in Silverlight application?
本文介绍了在Silverlight应用程序中进行会话?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我试图在silverlght应用程序中管理用户会话,但classe会话不存在!!!如何在Silverlight中管理用户会话?
thx
Hi,
I tried to manage user session in silverlght application, the classe session doesn''t exsit!!! how can manage user session in silverlight???
thx
推荐答案
请转到以下链接...
http://www.mindfiresolutions.com/Session-management-in- Silverlight-and-WCF-service-418.php [ ^ ]
Please, go to the following link...
http://www.mindfiresolutions.com/Session-management-in-Silverlight-and-WCF-service-418.php[^]
Silverlight不直接支持会话.
不过,您可以使用隔离存储-请参见此处 [ ^ ].
Silverlight does not directly support sessions.
You can make use of Isolated Storage though - see here[^].
Now I created Method in Wcf service like this:
<pre>
<pre lang="cs">[ServiceContract(Namespace = "")]
[AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
public class Service1
{
[OperationContract]
public void DoWork()
{
// Add your operation implementation here
return;
}
// Add more operations here and mark them with [OperationContract]
[OperationContract]
public void SetSessionVariable(string SessionKey)
{
System.Web.HttpContext.Current.Session["key"] = SessionKey;
System.Web.HttpContext.Current.Session.Timeout = 20;
// Add your operation implementation here
}
[OperationContract]
public String GetSessionvariable()
{
return System.Web.HttpContext.Current.Session["key"].ToString();
}</pre>
</pre>
and update the service in the client side application and write the following code in the login page:
<pre>
wcfService.Service1Client client = new wcfService.Service1Client();
client.GetSessionvariableCompleted += new System.EventHandler<wcfService.GetSessionvariableCompletedEventArgs>(client_GetSessionvariableCompleted);
client.GetSessionvariableAsync();</pre>
<pre lang="cs">void client_GetSessionvariableCompleted(object sender, wcfService.GetSessionvariableCompletedEventArgs e)
{
}</pre>
</pre>
i had an exeption in the wcf service at the method GetSessionvariable asking me Object reference not set to an instance of an object.
i need to get the session key from the method GetSessionvariable!!!
someone can help me please??????????
这篇关于在Silverlight应用程序中进行会话?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文