Sign In| Join
Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Feb 05, 2013 03:48 PM by Afzaal.Ahmad.Zeeshan
Member
732 Points
449 Posts
Mar 11, 2012 12:03 PM|LINK
I want to convert this PHP code into C# razor
Can someone help me?
<?php if (!isset($_SERVER['HTTP_X_REQUESTED_WITH']) || parse_url($_SERVER['HTTP_REFERER'], PHP_URL_HOST) != $_SERVER['HTTP_HOST']) { die('Denied. Use http://download.finance.yahoo.com/d/quotes.csv?s=[from][to]=X&f=l1'); } header('Content-Type: text/plain'); $amount = $_GET['amount']; $source_currency = $_GET['source_currency']; $target_currency = $_GET['target_currency']; $ex_rate = floatval(file_get_contents('http://download.finance.yahoo.com/d/quotes.csv?s='.$source_currency.$target_currency.'=X&f=l1')); echo round($ex_rate*$amount, 2); ?>
Star
8068 Points
1023 Posts
Microsoft
Mar 13, 2012 02:42 AM|LINK
Hi
I think you can use PHP to ASP.NET 1.x Migration Assistant to convert it first.
Then convert to C# Razor.
Hope it helpful.
Mar 13, 2012 08:54 PM|LINK
This requires .Net version 1.1.4322,
anyway i installed it but could not install ASP.NET 1.x Migration Assistant due to an unexpected error!
Mar 28, 2012 03:17 PM|LINK
Can someone review/correct this please?
@{ var amount = Request["amount"]; var source_currency = Request["source_currency"]; var target_currency = Request["target_currency"]; var result = ""; string serverURL =@"http://download.finance.yahoo.com/d/quotes.csv?s="+source_currency+target_currency"=X&f=l1";; result = serverURL*amount, 2; }
23 Points
16 Posts
Feb 05, 2013 01:15 PM|LINK
I tried to install ASP.NET 1.x Migration Assistant and it blew up. It no worky.
All-Star
33063 Points
8516 Posts
Moderator
Feb 05, 2013 01:19 PM|LINK
that migration assistant is older than the hills and really didn't work well even in its hayday. Just my 2 cents worth.
Feb 05, 2013 01:21 PM|LINK
Here are a couple links that might help you do this:
http://msdn.microsoft.com/en-gb/magazine/hh148144.aspx
http://forums.asp.net/t/1677953.aspx/1
Contributor
2661 Points
1040 Posts
Feb 05, 2013 03:48 PM|LINK
you are using two ";" at end of serverURL string.
dow7
Member
732 Points
449 Posts
convert from php to C# razor
Mar 11, 2012 12:03 PM|LINK
I want to convert this PHP code into C# razor
Can someone help me?
<?php if (!isset($_SERVER['HTTP_X_REQUESTED_WITH']) || parse_url($_SERVER['HTTP_REFERER'], PHP_URL_HOST) != $_SERVER['HTTP_HOST']) { die('Denied. Use http://download.finance.yahoo.com/d/quotes.csv?s=[from][to]=X&f=l1'); } header('Content-Type: text/plain'); $amount = $_GET['amount']; $source_currency = $_GET['source_currency']; $target_currency = $_GET['target_currency']; $ex_rate = floatval(file_get_contents('http://download.finance.yahoo.com/d/quotes.csv?s='.$source_currency.$target_currency.'=X&f=l1')); echo round($ex_rate*$amount, 2); ?>Dino He - MS...
Star
8068 Points
1023 Posts
Microsoft
Re: convert from php to C# razor
Mar 13, 2012 02:42 AM|LINK
Hi
I think you can use PHP to ASP.NET 1.x Migration Assistant to convert it first.
Then convert to C# Razor.
Hope it helpful.
If you have any feedback about my replies, please contact msdnmg@microsoft.com
Microsoft One Code Framework
dow7
Member
732 Points
449 Posts
Re: convert from php to C# razor
Mar 13, 2012 08:54 PM|LINK
This requires .Net version 1.1.4322,
anyway i installed it but could not install ASP.NET 1.x Migration Assistant due to an unexpected error!
dow7
Member
732 Points
449 Posts
Re: convert from php to C# razor
Mar 28, 2012 03:17 PM|LINK
Can someone review/correct this please?
@{
var amount = Request["amount"];
var source_currency = Request["source_currency"];
var target_currency = Request["target_currency"];
var result = "";
string serverURL =@"http://download.finance.yahoo.com/d/quotes.csv?s="+source_currency+target_currency"=X&f=l1";;
result = serverURL*amount, 2;
}
SweatCoder
Member
23 Points
16 Posts
Re: convert from php to C# razor
Feb 05, 2013 01:15 PM|LINK
I tried to install ASP.NET 1.x Migration Assistant and it blew up. It no worky.
bbcompent1
All-Star
33063 Points
8516 Posts
Moderator
Re: convert from php to C# razor
Feb 05, 2013 01:19 PM|LINK
that migration assistant is older than the hills and really didn't work well even in its hayday. Just my 2 cents worth.
bbcompent1
All-Star
33063 Points
8516 Posts
Moderator
Re: convert from php to C# razor
Feb 05, 2013 01:21 PM|LINK
Here are a couple links that might help you do this:
http://msdn.microsoft.com/en-gb/magazine/hh148144.aspx
http://forums.asp.net/t/1677953.aspx/1
Afzaal.Ahmad...
Contributor
2661 Points
1040 Posts
Re: convert from php to C# razor
Feb 05, 2013 03:48 PM|LINK
you are using two ";" at end of serverURL string.
~~! FIREWALL !~~