Click here to Skip to main content
15,883,953 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
My method in my web service C#

[WebMethod(EnableSession=true)]
   public string HelloWorld()
   {
       int? Count = (int?)Session["Count"];
       if(Count == null)
       {
           Count = 0;
       }

       Count++;

       Session["Count"] = Count;

       return "Hello World - Call Number : " + Count.ToString();
   }


how can I use CookieContainer class in my windows application client (not web Forms) ???
Can you write me exactly how to code it ?
Posted

1 solution

C#
Using cookies.

When you send HTTP requests, make sure to include a CookieContainer. (assuming you're using HttpWebRequest)


and you can follow the link below further .

Maintaining Session from the Client Application to the Web Service[^]
 
Share this answer
 
Comments
Member 10872485 11-Jul-14 5:04am    
Excuse me, but I don't use HttpWebRequest in my window application client, just I wrote :

using WindowsFormsApplicationName.ServiceReference;
...
private NameServiceSoapClient WS = new NameServiceDataSoapClient();
...

private void btnTest_Click(object sender, EventArgs e)
{
// Can you write me how to use CookieContainer here ?
string DataPOST = WS.HelloWorld();
MessageBox.Show(DataPOST);
}

Can you write me how to use CookieContainer here if I don't use HttpWebrequest ?

Thank you very much :)
Pravuprasad 11-Jul-14 5:13am    
refer this link. and you can use HttpWebRequest in windows forms app also.
Member 10872485 11-Jul-14 5:36am    
Your link relates to a WebForms Client and it is not clear for WindowsApplication Client,
can you be more clear in your reply please ?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900