I am trying to connect my wallet (Metamask) via Infura, but I receiving an error. My code:
[HttpPost]
public async Task<IActionResult> LoginAsync([ModelBinder(typeof(AccountBinder))] Account acc)
{
try
{
Account.ValidateAddress(acc.AccountAddress);
var web3 = new Web3(acc.AccountNetwork + "" + acc.InfuraApiKey); //infura Ropsten+ProjectID
var balance = await web3.Eth.GetBalance.SendRequestAsync(acc.AccountAddress); //works fine
var etherAmount = Web3.Convert.FromWei(balance.Value); //works fine
acc.AccountBalance = (double)etherAmount;
var unlockAccountResult = await web3.Personal.UnlockAccount.SendRequestAsync(acc.AccountAddress, acc.AccountPassword, 60); //not working!!!!!!!! <- <- <-
if (unlockAccountResult)
{
acc.IsValidated = true;
return View("Login", acc);
}
else
throw new WrongAccountDetails("Incorrect account or password");
}
catch (WrongAccountDetails ex)
{
...
}
}
I getting this error:
An unhandled exception occurred while processing the request.
RpcResponseException: The method personal_unlockAccount does not exist/is not available
Nethereum.JsonRpc.Client.ClientBase.HandleRpcError(RpcResponseMessage response)
Nethereum.JsonRpc.Client.ClientBase.HandleRpcError(RpcResponseMessage response)
Nethereum.JsonRpc.Client.ClientBase.SendInnerRequestAsync(RpcRequestMessage reqMsg, string route)
Nethereum.JsonRpc.Client.ClientBase.SendInnerRequestAsync(RpcRequest request, string route)
Nethereum.JsonRpc.Client.ClientBase.SendRequestAsync(RpcRequest request, string route)
RealEstate_Web_app.Controllers.AccountController.LoginAsync(Account acc) in AccountController.cs
+
var unlockAccountResult = await web3.Personal.UnlockAccount.SendRequestAsync(acc.AccountAddress, acc.AccountPassword, 60);
And so on....