I have two handler methods in razor pages for:
- request telegram code.
 - send verification code.
 
How can I keep an instance of Wtelegram Client between requests? I tried JsonSerializer but got below error!
Serialization and deserialization of 'WTelegram.Client+TcpFactory' instances are not supported. Path: $.TcpHandler
public async Task<IActionResult> OnPostCodeAsync()
{
  var wClient = new Client(Config, store);
  HttpContext.Session.SetString(telSession, JsonSerializer.Serialize(wClient));
  Msg = await _wClient.Login(PhoneNumber);
}
public async Task<IActionResult> OnPostVerifyAsync()
{
  var value = HttpContext.Session.GetString(telSession);
  var wClient = JsonSerializer.Deserialize<Client>(value);
  Msg = await wClient.Login(VerificationCode);
}
Or how can I tell WTelegram to continue another sign in process using simple string and int properties?
                        
See the official ASP.NET example showing how to keep a singleton of the client/service while performing the login and further API calls.