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??????????