本文整理汇总了C#中System.Net.WebClient.UploadStringAsync方法的典型用法代码示例。如果您正苦于以下问题:C# System.Net.WebClient.UploadStringAsync方法的具体用法?C# System.Net.WebClient.UploadStringAsync怎么用?C# System.Net.WebClient.UploadStringAsync使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Net.WebClient
的用法示例。
在下文中一共展示了System.Net.WebClient.UploadStringAsync方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: StartList
/// <summary>
/// 1.开始列表获取
/// </summary>
/// <param name="path"></param>
/// <param name="iType"></param>
public static void StartList(string path, LiuXingType iType)
{
if (string.IsNullOrEmpty(path)) return;
// 解析数据
using
(
var datadown = new System.Net.WebClient
{
Encoding = iType.Encoding,
Proxy = iType.Proxy
}
)
{
datadown.Headers.Add(System.Net.HttpRequestHeader.UserAgent, "Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/30.0.1581.2 Safari/537.36");
if (iType.Sign.Contains("M1905List"))
{
datadown.Headers.Add("order", "listorder");
datadown.Headers.Add("videotype", "3");
datadown.Headers.Add(System.Net.HttpRequestHeader.ContentType, "application/x-www-form-urlencoded");
datadown.UploadStringAsync(new System.Uri(path), "POST", "page=1&pagesize=10&order=listorder&videotype=3", iType);
datadown.UploadStringCompleted += Datadown_UploadStringCompleted;
}
else
{
if (iType.Sign.Contains("M1905Second"))
{
datadown.Headers.Add("filmid", iType.Sign.Split(',')[1]);
datadown.Headers.Add(System.Net.HttpRequestHeader.ContentType, "application/x-www-form-urlencoded");
datadown.UploadStringAsync(new System.Uri(UrlCodeHelper.GetListHttpPath(0, 0, iType).Replace("filmlist", "filmdetail")), "POST", "filmid=" + iType.Sign.Split(',')[1], iType);
datadown.UploadStringCompleted += Datadown_UploadStringCompleted;
}
else
{
if (iType.Type == LiuXingEnum.ZhangYuSearchItem)
{
datadown.Headers.Add("Cookie", "Hm_lvt_69521636d966ad606a32d89b1d70ee73=1376875963,1376889226; Hm_lpvt_69521636d966ad606a32d89b1d70ee73=1376889233; ce=gY1lvwT");
}
if (iType.Type == LiuXingEnum.DyfmHotApi)
{
datadown.Headers.Add("Cookie", "last_visit=" + System.Guid.NewGuid().ToString().Replace("-", "").Substring(0, 24) + "Hm_lpvt_10701d9b4e040e37e58bee7e1ec1d252=1376902145");
}
datadown.DownloadStringAsync(new System.Uri(path), iType);
datadown.DownloadStringCompleted += Datadown_DownloadStringCompleted;
}
}
}
}