用于win8.1的BackgroundDownloader无法正常工作 [英] BackgroundDownloader for win8.1 not working

查看:87
本文介绍了用于win8.1的BackgroundDownloader无法正常工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个类似http://my.domai.com/myfile.doc的文件的网址,如果我在浏览器中打开它,会打开一个弹出窗口输入用户名和密码,之后我可以查看或下载文件。现在我必须在我的win 8.1应用程序中进行此下载。我使用下面的代码:



I have a url for a file something like "http://my.domai.com/myfile.doc" and if I open this in browser, a popup opens to enter username and password, after that I can view or download file. Now I have to do this download in my win 8.1 app. I used code below:

BackgroundDownloader backgroundDownloader = new BackgroundDownloader();
var credentials = GetNetworkCredential();
backgroundDownloader.ServerCredential = new Windows.Security.Credentials.PasswordCredential("Lighthouse", credentials.UserName, credentials.Password);
CancellationTokenSource cts = new CancellationTokenSource();

DownloadOperation downloadOperation = backgroundDownloader.CreateDownload(new Uri(System.Net.WebUtility.UrlDecode(searchDoc.Path)), fileToSave);
downloadOperation.StartAsync();





但没有任何反应,没有错误没有数据。任何人都可以帮忙吗?



But nothing happens, no error no data. Can anyone help?

推荐答案

这不是有效的URL。有效的URL应以URI Schemehttp://或https://开头。您应该知道DNS域中规定的域名。



请参阅:

http://en.wikipedia.org/wiki/URI_scheme [ ^ ],

http:// en.wikipedia.org/wiki/DNS [ ^ ]。



-SA
This is not a valid URL. Valid URL should start with the URI Scheme "http://" or perhaps "https://". You domain should be known to the DNS, prescribed in the DNS data.

Please see:
http://en.wikipedia.org/wiki/URI_scheme[^],
http://en.wikipedia.org/wiki/DNS[^].

—SA


这篇关于用于win8.1的BackgroundDownloader无法正常工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆