Click here to Skip to main content
15,867,568 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

I have included a method in the class file and i have called the same method inside the main code. While i tried in our environment by sharing the remote machines it was disconnecting the session. But if we tried in terminal server the connection is not disconnecting.

Please find the method below. Kindly help me to solve this issue.

public string RemoteComputer
{
get
{
return this._remoteComputer;
}
set
{
this._remoteComputer = value;
this._remoteUncName = @"\\" + this._remoteComputer;
}
}

public void Dispose()
{
this.DisconnectFromShare(this._remoteUncName);
}
Posted
Comments
Bernhard Hiller 8-Sep-14 9:21am    
And what's the code of "DisconnectFromShare"?
Kamal Kannan 8-Sep-14 10:13am    
private void DisconnectFromShare(string remoteUnc)
{
int result = WNetCancelConnection2(remoteUnc, CONNECT_UPDATE_PROFILE, false);
if (result != NO_ERROR)
{
throw new Win32Exception(result);
}
}
Kamal Kannan 9-Sep-14 1:01am    
Can anyone help me out for this issue?

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