How to read state file blazor_server_side?

Hello,

How to read the state file blazor_server_side?

You can see my code here:

const string stateFile = "state.bin";
        try
        {
            
            if (File.Exists(stateFile))
            {
                              message = "Loading state from file";

                using (var fs = File.OpenRead(stateFile))
                {
                    //_instaApi.LoadStateDataFromStream(fs);
                    _instaApi.LoadStateDataFromString(new StreamReader(fs).ReadToEnd());

                }
            }
        }

This code doesn’t work for me and a red line appears under it.

Should I change any part?

thanks,

Saeed

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.