tags:

views:

49

answers:

3

I was working on a rewards website in php and mysql. I have almost finished everything but the client now wants the website to be in .net and not php. Most of the php coding is completed and it is not possible to start from scratch in .net and finish the whole website in 2 weeks.

I am good with php but not much knowledge about c# or aspx. is there any chance that i can just modify the php pages into aspx pages or create new aspx pages and re-direct? I am basically clue-less here so i need some suggestions.

Appreciate any help provided.

A: 

There's no automatic way to port it to ASP.NET. I would suggest talking to your client and explaining the situation, and that it's gonna take a long time to rewrite the code in ASP.NET (you should still ask for your payment now)

Daniel S
There's no automatic way... Yet. That's what I am working on.
NullUserException
Well i can ask them for more time.. maybe a month or so, but is there any way i can integrate the php code into a aspx page?
Scorpion King
+3  A: 

Explain to your client that this is not feasible. Besides, they'll now have to pay a whole lot of money to Microsoft for the server stack. Besides PHP runs fine on Windows, with Apache or IIS.

if they still won't do it... Depending on their knowledge level you can just "fake" your PHP pages as ASPX. That's really easy to do with Apache. Just add the following line to your .htaccess file:

AddType application/x-httpd-php .aspx

And rename all your .php files to .aspx. Sometimes clients are just stubborn and want a particular technology but have no clue why they want to do it. It's usually because "someone" told them it XYZ was "better."


Edit: There's nothing stopping you from integrating the new website into their existing ASPX website, even though they are not using the same technology. I suppose they have a MSSQL backend, and PHP can connect to that. With a little work (and cookies), you can even make it seamlessly keep the user logged into both sites.

NullUserException
wow never knew this, +1 for crazy hack
Alex
well they just want the website to be as aspx and not php. I do not know if they are knowledgable to identify that this is fake. and even if i do like how you mentioned, then is it enough if i re-name all my php files as apsx and things will work fine?
Scorpion King
That is correct. Of course you'd need to change your includes to point to .aspx files, but that shouldn't be hard.
NullUserException
ok thanks for the suggestion. But would all the php get functions and other functions of php be intact and work the same way despite to changing the extension? I have somepages where userID is passed in the URL and php gets it, runs query and generates data... would the same thing work?
Scorpion King
@Scorpion Yes, as far as PHP is concerned, it's just a PHP script.
NullUserException
Hey the php code is being shown in the browser when i change the extension from php to aspx. What is the problem? I just added `<?php phpinfo(); ?>` to a new file test.aspx and I see a blank page. So there is no php installed on that machine? I am more than certain that php is installed in that machine.
Scorpion King
@Scorpion Did you change your `.htaccess`? Is that machine running apache?
NullUserException
`AddType application/x-httpd-php .aspx` this is only code that i placed in .htaccess file and i placed this .htaccess file at the same location where the test.aspx page is present. It is running on apache only. I did not htaccess file before. I just created it now and that is the online line in that.
Scorpion King
@Scorpion Some servers are configured so you can't use `.htaccess`. You might want to test if `.htaccess` works. If it doesn't you'll have to check with your hosting provider. If that you are on localhost, check your httpd.conf's `AllowOverride` setting
NullUserException
My host provide set AllowOveride to AuthConfig and not All since there are some security issues. The htaccess file has only the code that you gave and now it is showing `Internal Server ErrorThe server encountered an internal error or misconfiguration and was unable to complete your request`if i remove the htaccess file or leave it empty, the website is running fine.
Scorpion King
The error i am getting is `addtype not allowed here`
Scorpion King
@Scorpion Then you can't do that. You might ask them to add that line to their httpd.conf, but I doubt they would let you.
NullUserException
A: 

Would running PHP on IIS be an option? As others have mentioned, PHP and ASP.NET is two different beast and you would have to rewrite the code.

jpartogi
They just want the website to be in aspx. They have a website which is running on that and want this php website that i created, to be integrated into that website and it should be in aspx and not php. Hope that i am clear.
Scorpion King