Reputation: 245459
I am currently trying to write a Windows Phone 7.1 Application that allows you to access Coursera class information, including streaming lectures.
I want to be able to also allow users to download lecture videos a slides (PDFs). Unfortunately the files are protected. This isn't normally isn't an issue. I have my ClientHttpWebRequest
set up to use a CookieContainer
. This is all well and good.
The fun comes when trying to use a BackgroundTransferRequest
to download the assets. The class doesn't allow you to supply a CookieContainer
instance for cookies. This means that I have to set the values using BackgroundTransferRequest.Headers
.
Coursera returns its session cookie as an HttpOnly cookie. Unfortunately, the ClientHttpWebRequest
doesn't allow you to access HttpOnly cookies from the response and, by proxy, means I can't read the session cookie from the CookieContainer
either.
Is there anything obvious that I'm missing out there that will allow me to access the value that I'm interested in or do I need to come up with my own Background File Transfer infrastructure?
Upvotes: 5
Views: 437
Reputation: 65566
No, you're not missing anything. This is a gap in the SDKs offering.
I can think of 2 possible alternatives though.
Have the app run under the lock screen and handle the downloads yourself. - This is how we had to do it before background file transfer was available.
Have your own proxy server that sits between the app and the other site which can handle the cookie side of things for you and make the files available direct to the app. Obviously there are probably important security considerations to take into account before adopting this approach. There may also be additional costs for running and maintaining the server.
Upvotes: 1