Archived Forum Post

Index of archived forum posts

Question:

Log Files on WinPhone, WinRT, Windows Store, etc.

Sep 09 '16 at 08:00

I'am having trouble debugging null response from a server using http.PostJson2Async. I'am getting responses from other servers just fine, but this specific one is returning null(timeouts). It would help if I could get session log, but http.SessionLogFilename = "E:\httpSessionLog.txt"; does not create any logs.


Answer

On WinPhone, WinRT, etc. (just like for iOS), a program cannot create files anywhere on the filesystem. You're restricted to your application's data folder. Therefore, one must get the application's data folder and then construct a path from it..

For example:

Windows.Storage.StorageFolder localFolder = Windows.Storage.ApplicationData.Current.LocalFolder;
http.SessionLogFilename = localFolder.Path + @"\sessionLog.txt";