WindowsDevicePortalWrapper icon indicating copy to clipboard operation
WindowsDevicePortalWrapper copied to clipboard

DeleteFileAsync doesn't work on hololens

Open lucielem opened this issue 8 years ago • 2 comments

I test this function but it doesn't work : Task deleteTask = new Task( async () => {

        await portal.DeleteFileAsync("Documents", "test.txt");
        Debug.Log("delete finished!");
    });
    deleteTask.Start();

lucielem avatar Oct 30 '17 14:10 lucielem

Hello,

After experiencing the same problem (on a project aiming for file transfer on hololens) I noticed that the request sent to the device wasn't including authorization headers (401 error). Further investigations made me notice that POST request has the same issue, but when my client receive the error message, it sends again the request including authorization headers.

In order to bypass this problem, I had to add the following code line in RestDelete.cs before calling "DeleteAsync".

client.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue( "Basic", Convert.ToBase64String(System.Text.ASCIIEncoding.ASCII.GetBytes(string.Format("{0}:{1}",this.deviceConnection.Credentials.UserName,this.deviceConnection.Credentials.Password))));

davpot avatar Nov 16 '17 09:11 davpot

Having the same problem! Trying to figure out a better solution, anyone know why the header isn't included?

mwarvik avatar Mar 03 '21 10:03 mwarvik