TLSharp
TLSharp copied to clipboard
web app faces `Access to the path 'C:\\Program Files (x86)\\IIS Express\\session.dat' is denied.`
I installed TLSharp nuget package (v 0.1.0.274) in a mvc web app and try to use it, but it gives Access denied error in this line:
var client = new TelegramClient(3887, "78b0dcedc3e3b75a9ee63a0e1e604")
Error:
Access to the path 'C:\Program Files (x86)\IIS Express\session.dat' is denied.
so i tried to change permissions of that folder but it didn't solve anything.
I tested the package in a console app and it works properly I think because the session.dat file was made in /Bin/Debug/session.dat but in web app it try to use \IIS Express folder to make session file) How can i solve this problem? Regards
Here is my complete code:
static async Task<long> GetSeenCount(string channelPublicLink, long postId)
{
try
{
var client = new TelegramClient(1887, "78b0dced01c3ba75a9ee63a0e1e604");//Error
await client.ConnectAsync();
var hash = await client.SendCodeRequestAsync("+195916383");
var code = "<code_from_telegram>"; // you can change code in debugger
var user0 = await client.MakeAuthAsync("+195916383", hash, code);
//.... other functions ....
}
}
Right click Visual Studio, "Run as administrator"
Do you need to save sessions? If so, you have to implement ISessionStore interface, to save the session somewhere else, not in a file. If you don't need that, then just use a FakeSessionStore like this:
_client = new TelegramClient(_telegramApiId, _telegramApiHash, new FakeSessionStore());
What I need do if i want save sessions in file?