本文介绍了在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

推荐答案



Now I created Method in Wcf service like this:
<pre>
<pre lang="cs">[ServiceContract(Namespace = &quot;&quot;)]
[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[&quot;key&quot;] = SessionKey;
        System.Web.HttpContext.Current.Session.Timeout = 20;
        // Add your operation implementation here
    }
    [OperationContract]
    public String GetSessionvariable()
    {
        return System.Web.HttpContext.Current.Session[&quot;key&quot;].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&lt;wcfService.GetSessionvariableCompletedEventArgs&gt;(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应用程序中进行会话?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-13 01:05