wiz0u / WTelegramClient

Telegram Client API (MTProto) library written 100% in C# and .NET
https://wiz0u.github.io/WTelegramClient/
MIT License
956 stars 156 forks source link

ReUse Saved Session with File.Open #236

Closed lucaswhob closed 6 months ago

lucaswhob commented 6 months ago

Hello Please Provide Example I Have Exactly Same This Error ! I Create Session with this method clienttelegram = new WTelegram.Client(12XXX,"bXXXX",HttpContext.Current.Server.MapPath("/tempkey.session")); string task = Task.Run(async () => await clienttelegram.Login(countrycodeandphone)).Result; Login Ok Session File Created Successfully ! But When I Resuse Created File Error : WTelegram.WTException: 'Exception while reading session file: The input data is not a complete block. Use the correct api_hash/id/key, or delete the file to start a new session' static string Config(string what) { switch (what) { case "api_id": return "12XXXXX"; case "api_hash": return "bd4XXXXXX"; case "phone_number": return "+9891XXXX"; case "verification_code": return ""; case "first_name": return ""; case "last_name": return ""; case "password": return ""; default: return null; } } clienttelegram = new WTelegram.Client(Config, File.Open(HttpContext.Current.Server.MapPath("~/tempkey.session"), FileMode.Open));

wiz0u commented 6 months ago

Duplicate of #234