xxx是不是一个有效的虚拟路径? [英] xxx is not a valid virtual path?
本文介绍了xxx是不是一个有效的虚拟路径?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我用的XmlDataSource
是这样的:
<asp:XmlDataSource ID="xmlDataSource1" runat="Server" DataFile="https://myurl.xml" ></asp:XmlDataSource>
作为数据源到我的 rotater
控制。
但我得到下面的异常所有的时间:
but i get the following exception all the time :
的https://myurl.xml 是不是有效的虚拟路径
https://myurl.xml is not a valid virtual path.
虽然我试图链接和外部有一个XML文件
Although i tried the link externally and there's an xml file
推荐答案
忽略我的previous答案。显然,的XmlDataSource
不喜欢https网址为数据文件
:
Ignore my previous answer. Apparently the XmlDataSource
does not like https URLs as the DataFile
:
// works
xmlDataSource1.DataFile = "http://code.google.com/feeds/p/google-code-prettify/svnchanges/basic";
// does not work
xmlDataSource1.DataFile = "https://code.google.com/feeds/p/google-code-prettify/svnchanges/basic";
写code的一些额外的线路从https下载XML数据源,如:
Write a few extra lines of code to download the XML from https source like:
HttpWebRequest request = (HttpWebRequest)WebRequest.Create("https://code.google.com/feeds/p/google-code-prettify/svnchanges/basic");
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
StreamReader reader = new StreamReader(response.GetResponseStream());
string str = reader.ReadToEnd();
// save it or set it as the .Data property of XmlDataSource
这篇关于xxx是不是一个有效的虚拟路径?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文