private string SendCommand(string command, string[] args)
 {
     this.remoteCommand = new RemoteCommand(command, args);
     this.SendEventInfo(this.vEventLevel, Evt.e4cmdrunned, "");
     using (HttpWebResponse response = (HttpWebResponse)CreateWebRequest(this.remoteCommand).GetResponse())
     {
         if (response.StatusCode != HttpStatusCode.OK)
         {
             string msg = response.StatusDescription;
             this.SendEventInfo(this.vEventLevel, Evt.e1errorcmd, msg);
             this.remoteCommand.ReportError(this.vErrorLevel, Err.e1server, msg);
         }
         return(ReadResponse(response));
     }
 }
        /// <summary>
        /// Builds an HTTP request based on the specified remote Command
        /// </summary>
        /// <param name="command">the command we'll send to the server</param>
        /// <returns>an HTTP request, which will perform this command</returns>
        public virtual WebRequest CreateWebRequest(RemoteCommand command)
        {
            byte[] data = BuildCommandPostData(command.CommandString);

            HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);

            request.Method      = "POST";
            request.ContentType = "application/x-www-form-urlencoded; charset=utf-8";
            request.Timeout     = Timeout.Infinite;

            Stream rs = request.GetRequestStream();

            rs.Write(data, 0, data.Length);
            rs.Close();

            return(request);
        }
		private string SendCommand(string command, string[] args)
		{
			this.remoteCommand = new RemoteCommand(command, args);			
			this.SendEventInfo(this.vEventLevel,Evt.e4cmdrunned, "" );
			using (HttpWebResponse response = (HttpWebResponse) CreateWebRequest(this.remoteCommand).GetResponse())
			{
				if (response.StatusCode != HttpStatusCode.OK)
				{
					string msg = response.StatusDescription;
					this.SendEventInfo(this.vEventLevel,Evt.e1errorcmd, msg );						
					this.remoteCommand.ReportError( this.vErrorLevel, Err.e1server, msg );				
				}
				return ReadResponse(response);
			}
		
		}
 /// <summary>
 /// Builds an HTTP request based on the specified remote Command
 /// </summary>
 /// <param name="command">the command we'll send to the server</param>
 /// <returns>an HTTP request, which will perform this command</returns>
 public virtual WebRequest CreateWebRequest(RemoteCommand command)
 {
     byte[] data = BuildCommandPostData(command.CommandString);
     
     HttpWebRequest request = (HttpWebRequest) WebRequest.Create(url);
     request.Method = "POST";
     request.ContentType = "application/x-www-form-urlencoded; charset=utf-8";
     request.Timeout = Timeout.Infinite;
     
     Stream rs = request.GetRequestStream();
     rs.Write(data, 0, data.Length);
     rs.Close();
     
     return request;
 }