RasGetConnectStatus() not working

Hi everybody,
  Is there someone who can tell me why the RASGetConnectStatus() is not functioning and how to fixed this I like to get status of ras in order to maintain the connection until explicitly close by user. Also, the RasHangUp() also not working properly. Thanks in Advance.

[code]
private void ReconnectVPNRAS()
{
   while (this.CheckRasConnection(this.IDConnexionRAS) == false)
   {
 string connectName = this.txtIpAddress.Text;
 string user = this.txtUsername.Text;
 string pass = this.txtPassword.Text;
  
 this.OpenConnection(connectName,user,pass,"");
 Thread.Sleep(1000);
   }
}

public bool OpenConnection(string pNomConnection,string pUser,string pPassword,string pDomain)
{
   .....

   uint res = RasDial(0,null,TabParams,0,0,ref IDConnexionRAS);
   .....
}
[\code]


[code]
public bool GetRasConnectStatus(int idConn)
{   
   uint res = RasAPI.RasGetConnectStatus(idConn, ref status);
   if (res == 0)
   {
 status.rasconnstate = RASCONNSTATE.RASCS_Connected;
 return true;
   }
   else
   {
 status.rasconnstate = RASCONNSTATE.RASCS_Disconnected;
 return false;
   }
}

[DllImport("rasapi32.dll",CharSet=CharSet.Auto)]
public extern static uint RasGetConnectStatus(
 int pRasConn,  // handle to RAS connection of interest
 ref RASCONNSTATUS lprasconnstatus
 // buffer to receive status data
);
[\code]


denpsia

 



Answer this question

RasGetConnectStatus() not working

  • fraXis

    This forum is intended for questions relating to the System.Net namespace. In order to get the best answer to your question, please repost this on an alternate forum. See http://www.microsoft.com/community

  • RasGetConnectStatus() not working