Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 2.0 > Visual Web Developer 2005
|
Visual Web Developer 2005 Discuss creating ASP.NET 2.0 sites with Microsoft's Visual Web Developer 2005. If your question is more specific to a piece of code than the Visual tool, see the ASP.NEt 2.0 forums instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Visual Web Developer 2005 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old August 8th, 2012, 07:01 AM
Registered User
 
Join Date: Aug 2012
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Code conversion for a client from PHP to ASP

Hi,

I have a client needs to convert this piece of code from php to asp

PHP Code:
<?

//create the ActiveSocket FTP object
$activeFtp = new com("ActiveXperts.FtpServer");

if(isset(
$_GET['method'])){

  
//set the logfile:
  
$activeFtp->logfile $_POST["logfile"];

  
//connect the server
  
$activeFtp->connect($_POST["server"], $_POST["username"], $_POST["password"]);

  
//change directory
  
$activeFtp->ChangeDir($_POST["dir"]);
  
  
//display the table in witch we are going to present our information
  
echo "<table>";
  echo 
"  <tr>";
  echo 
"    <td colspan=1 class=header>";
  echo 
"Size:";
  echo 
"    </td>";
  echo 
"    <td class=header>";
  echo 
"Filename:";
  echo 
"    </td>";
  echo 
"  </tr>";

  
//get the firstfile (if the first file is fetched, move on to the next untill there is no next file, then an error will occure)  
  
$files $activeFtp->FindFirstFile();

  
//get the errors and descriptions
  
$error $activeFtp->Lasterror;
  
$description $activeFtp->GetErrorDescription($activeFtp->Lasterror);
  
  
//if the filename was successfully fetched, echo the filename and the filesize
  
while($activeFtp->Lasterror == 0){
    echo 
"  <tr>";
    echo 
"    <td class=size>";
    
//check if the file is a directory    
    
if($files->isDirectory == -1){
      
//if the file is a directory: echo "Directory"    
      
echo "Directory";
    }
    else{
      
//if the file isn't a directory, echo the filesize    
      
echo $files->size " Bytes";
    }
    echo 
"    </td>";
    echo 
"    <td class=filename>";
    echo 
$files->name "<br>";
    echo 
"    </td>";  
    echo 
"  </tr>";
    
    
//find the next file, and display it again..
    
$files $activeFtp->FindNextFile;    
  }
  
  
//close the table tag
  
echo "</table>";
  echo 
"<br>";

//close the if statement
}


//create a table and display the errors that have occured
echo "<table>";
echo 
"  <tr>";
echo 
"    <td colspan=1 class=header>";
echo 
"ErrorNo.:";
echo 
"    </td>";
echo 
"    <td class=header>";
echo 
"Error description:";
echo 
"    </td>";
echo 
"  </tr>";
echo 
"  <tr>";
echo 
"    <td class=size>";
echo 
$error;
echo 
"    </td>";
echo 
"    <td class=filename>";
echo 
$description;
echo 
"    </td>";
echo 
"  </tr>";
echo 
"</table>";

?>





Similar Threads
Thread Thread Starter Forum Replies Last Post
how to run php code in asp kyleshome Classic ASP Basics 8 February 11th, 2010 05:27 PM
In ASP,Client side javaScript code casimir Classic ASP XML 0 October 24th, 2005 12:24 AM
Writing Client side script in code-behind asp.net sajid_pk ASP.NET 2.0 Basics 1 February 11th, 2005 04:22 AM
Writing client side script in code-behind asp.net sajid_pk ADO.NET 1 January 13th, 2005 08:12 AM
writing client-side script in code-behind asp .net sajid_pk General .NET 1 January 13th, 2005 08:11 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.