Compiler Error Message: CS1501
2 posts
• Page 1 of 1
Compiler Error Message: CS1501
I keep getting this compile error and I dont understand why.
Compiler Error Message: CS1501: No overload for method 'johnny' takes '0' arguments
--------------------------
web.config (small section)
--------------------------
<sessionState timeout="10"/>
<compilation debug="true">
<assemblies>
<add assembly="PhpNetCore, Version=2.0.0.0, Culture=neutral, PublicKeyToken=0a8e8c4c76728c71"/>
</assemblies>
</compilation>
-----------------
App_Code/core.php
-----------------
<?
import namespace System;
import namespace System:::Data;
import namespace System:::Web;
import namespace System:::Web:::UI;
namespace hciPHP
{
class johnny
{
private $strName;
public function __construct()
{
$this->strName = 'mysql';
}
public function getDbaName()
{
return $this->strName;
}
}
}
?>
------------
Default.aspx
------------
<%@ Page Language="C#" %>
<%@ Import Namespace="hciPHP" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script language="C#" runat="server">
void Page_Load()
{
johnny objJohnny = new johnny();
string strDbaName = objJohnny.getDbaName();
Response.Write(strDbaName);
}
</script>
Compiler Error Message: CS1501: No overload for method 'johnny' takes '0' arguments
--------------------------
web.config (small section)
--------------------------
<sessionState timeout="10"/>
<compilation debug="true">
<assemblies>
<add assembly="PhpNetCore, Version=2.0.0.0, Culture=neutral, PublicKeyToken=0a8e8c4c76728c71"/>
</assemblies>
</compilation>
-----------------
App_Code/core.php
-----------------
<?
import namespace System;
import namespace System:::Data;
import namespace System:::Web;
import namespace System:::Web:::UI;
namespace hciPHP
{
class johnny
{
private $strName;
public function __construct()
{
$this->strName = 'mysql';
}
public function getDbaName()
{
return $this->strName;
}
}
}
?>
------------
Default.aspx
------------
<%@ Page Language="C#" %>
<%@ Import Namespace="hciPHP" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script language="C#" runat="server">
void Page_Load()
{
johnny objJohnny = new johnny();
string strDbaName = objJohnny.getDbaName();
Response.Write(strDbaName);
}
</script>
- bholbrook@codeplex
- Posts: 1
- Joined: January 7th, 2012, 8:57 pm
RE: Compiler Error Message: CS1501
Hi bholbrook,
Using C# as a language for writing ASP.NET pages and PHP as a language (or one of languages) used in App_Code is very interesting idea! I quite like it, because it allows people to use classes written in PHP together with new ASP.NET 2.0 projects. Just wondering, is this your case?
Ok, let's get back to your question :-). If you want to use class written in PHP from another language you should mark it with Export attribute like this:
Export
class johnny
{
// ..
}
This makes Phalanger to add overloads that are easilly accessible from "standard" .NET languages. You'll also need to modify the code that uses the class a little (added one type cast):
hciPHP.johnny objJohnny = new hciPHP.johnny();
string strDbaName = (string)objJohnny.getDbaName();
Response.Write(strDbaName);
If you'll have any other troubles, let us know, this is very interestng scenario!
Tomas
Using C# as a language for writing ASP.NET pages and PHP as a language (or one of languages) used in App_Code is very interesting idea! I quite like it, because it allows people to use classes written in PHP together with new ASP.NET 2.0 projects. Just wondering, is this your case?
Ok, let's get back to your question :-). If you want to use class written in PHP from another language you should mark it with Export attribute like this:
Export
class johnny
{
// ..
}
This makes Phalanger to add overloads that are easilly accessible from "standard" .NET languages. You'll also need to modify the code that uses the class a little (added one type cast):
hciPHP.johnny objJohnny = new hciPHP.johnny();
string strDbaName = (string)objJohnny.getDbaName();
Response.Write(strDbaName);
If you'll have any other troubles, let us know, this is very interestng scenario!
Tomas
- tomasp
- Posts: 46
- Joined: January 7th, 2012, 8:37 pm
2 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 36 guests