News  [SoftwareSite

Latest News
Older News
RSS Feed
 
Complete Projects
Useful Classes
Top Downloads
Message Board
AllAPI.net
 
Send Comments
Software License
Mentalis.org Buttons
Donate
 
Forums -> Security Library Forum
 
SecureSocket connection from WebService  
by Jan
posted on 2005/07/11

The SecureSocket-connection works fine when the connection is started from a windows service. But when I use the same library from a WebService the following error occurs:
System.ObjectDisposedException: Cannot access a disposed object named "Org.Mentalis.Security.Ssl.Shared.SocketController".
Object name: "Org.Mentalis.Security.Ssl.Shared.SocketController".
at Org.Mentalis.Security.Ssl.Shared.SocketController.BeginSend(Byte[] buffer, Int32 offset, Int32 size, AsyncCallback callback, Object state)
at Org.Mentalis.Security.Ssl.SecureSocket.BeginSend(Byte[] buffer, Int32 offset, Int32 size, SocketFlags socketFlags, AsyncCallback callback, Object state)
at Org.Mentalis.Security.Ssl.SecureSocket.Send(Byte[] buffer, Int32 offset, Int32 size, SocketFlags socketFlags)



Is this behaviour because of the WebService? Are there modifications possible to let the SecureSocket connection work in a WebService initiated environment?


Some of my code:
SecurityOptions options = new SecurityOptions(SecureProtocol.Ssl3);
options.Certificate = null;
options.Entity = ConnectionEnd.Client;
options.CommonName = configSettings["Host"];
options.VerificationType = CredentialVerification.Auto;
options.Verifier = null;
options.Flags = SecurityFlags.Default;
options.AllowedAlgorithms = SslAlgorithms.SECURE_CIPHERS;
SecureSocket _socket = new SecureSocket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp, options);
_socket.Connect(new IPEndPoint(Dns.Resolve(configSettings["Host"]).AddressList[0], int.Parse(configSettings["Port"])));

byte[] buffer = Encoding.ASCII.GetBytes(requestString);
_socket.Send(buffer, 0, buffer.Length, SocketFlags.None);

 

Copyright © 2002-2007, The Mentalis.org Team. All rights reserved.
This site is located at http://www.mentalis.org/
Send comments to the webmaster.