路径错误中的非法字符c#

时间:2015-09-25 15:06:07

标签: c#

我正在尝试从以下链接下载csv文件,但在最后一行抛出异常“路径错误中的非法字符”。我相信链接中的问号标志会弄乱一切,但我必须让它工作..有什么建议吗?

string remoteUri = "download.finance.yahoo.com/d/quotes.csv?s=%40%5EDJI,aapl&f=o&e=.csv";
string fileName = "aapl.csv", myStringWebResource = null;
// Create a new WebClient instance.
WebClient myWebClient = new WebClient();
// Concatenate the domain with the Web resource filename.
myStringWebResource = remoteUri + fileName;
// Download the Web resource and save it into the current filesystem folder.
myWebClient.DownloadFile(myStringWebResource, fileName);

2 个答案:

答案 0 :(得分:3)

这有效:

RewriteRule ^(.*)$ index.php/$1 [L]

答案 1 :(得分:1)

确定。让我们看看你的代码。

using System;
using System.Net;

public class Program
{
    public void Main()
    {
        string remoteUri = "http://download.finance.yahoo.com/d/quotes.csv?s=%40%5EDJI,aapl&f=o&e=.csv";

        using (var myWebClient = new WebClient())
        {
            string csv = myWebClient.DownloadString(remoteUri);
            Console.WriteLine(csv);
        }   
    }
}

测试解决方案:(演示.NETFiddle

using System;
using System.Net;

public class Program
{
    public void Main()
    {
        string remoteUri = "http://download.finance.yahoo.com/d/quotes.csv?s=%40%5EDJI,aapl&f=o&e=.csv";
        string fileName = "aapl.csv";

        using (var myWebClient = new WebClient())
        {
            myWebClient.DownloadFile(remoteUri, fileName);
        }   
    }
}

解决您的问题:

$(".jointeamPeepWrapper").each(function(){
    var tallestHeight = 0;
    $(this).children("div").each(function(){
        $(this).outerHeight("auto");
        if(parseInt($(this).outerHeight(true)) > tallestHeight){
            tallestHeight = parseInt($(this).outerHeight(true));
        }
    });
    $(this).children("div").outerHeight(tallestHeight);
});