Cookies and web services

  • Thread starter Laurent Bugnion
  • Start date
L

Laurent Bugnion

Hi,

I got a problem when I try to connect to a stateful web service using a
Windows Forms application (actually, a WPF application, but it's the same).

Simplified code:

SERVER:

[WebService( Namespace = "http://www.galasoft-lb.ch/" )]
[WebServiceBinding( ConformsTo = WsiProfiles.BasicProfile1_1 )]
[ToolboxItem( false )]
public class Service1 : System.Web.Services.WebService
{
[WebMethod( EnableSession=true )]
public string GetSessionId()
{
return Session.SessionID;
}
}

CLIENT:

private Service1 m_oService = new Service1();

public Form1()
{
InitializeComponent();
m_oService.CookieContainer = new CookieContainer();
}

private void bnExecute_Click( object sender, EventArgs e )
{
try
{
DisplayResults( m_oService.GetSessionId(), false );
}
catch ( Exception ex )
{
DisplayResults( ex.Message, true );
}
}

Any idea what's causing the problem? The cookies are never set.

Thanks,
Laurent
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top