ASP.NET - PHP to ASP.NET conversion

Asked By user 220 on 07-Jun-11 02:32 PM
Does anyone know how to convert the following PHP code to ASP.NET:

<?php
    $myFile = "includes/status.txt";
    $fh = fopen($myFile, 'r');
    $theData = fread($fh, 1);

    $status= $theData;

    if ( $status == 0) {
        include('includes/bol_down.aspx');
    } elseif ($status == 1){
        include('includes/login_form_up.aspx');
    }

    fclose($fh);
?>

Any help will be really great.
Ravi S replied to user 220 on 07-Jun-11 02:34 PM
HI

here is the tool

refer the link

http://www.asp.net/downloads/archived-v11/migration-assistants/php-to-aspnet
Santhosh N replied to user 220 on 07-Jun-11 02:39 PM
even though u have tools wich are helpful in converting code to diff languages, I would recommend to write it manually if that is small piece of code to take the advantage of the native code performances and maintainability within the technology you are developing...

for instance, the below code could be done using login and authentication controls in the Asp.net which are not available in php
Anoop S replied to user 220 on 07-Jun-11 02:58 PM
You can refer this link for migrating from PHP to ASP.NET, there you van see how to convert PHP code to asp.net, just for example
Code Sample 3. Basic output in PHP
Copy

<?php

$hello = "hi how are you\n";
echo $hello;

?>

Code Sample 3. Basic output in Visual Basic .NET
Copy

<%
Dim Hello As String = "Hi how are you" & vbcrlf

Response.Write(Hello)
%>

refer this for more details
http://msdn.microsoft.com/en-us/library/aa479002.aspx
Riley K replied to user 220 on 07-Jun-11 09:03 PM
You can however convert PHP to source code that can be compiled.

microsoft have a PHP to ASP.NET covnersion tool you can download.

http://

 

It isn't great, but it does the job.
Jitendra Faye replied to user 220 on 07-Jun-11 11:28 PM

You can however convert PHP to source code that can be compiled.

microsoft have a PHP to ASP.NET covnersion tool you can download.

http://www.asp.net/downloads/archived/migration-assistants/php-to-aspnet/


It isn't great, but it does the job.

The resutl is more like ASP than ASP.NET code.