Skip to main content

Problem unlockaccount on Rinkeby via infura

I got "405 Method Not Allowed" error when I tried to unlock an account I created on MetaMask. Here is the code:

string privateKey = "0xXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
string senderAddress = "0xXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";

var account = new Account(privateKey);
var web3 = new Web3(account, "https://rinkeby.infura.io/<token>");

var password = "xxxxxxx"; // where does this come from? the meta mask password???

// error on the line below
var unlockResult = await web3.Personal.UnlockAccount.SendRequestAsync(senderAddress, password, new HexBigInteger(120));

What have I done wrong? Where does 'password' come from?