本文整理汇总了C#中System.Net.WebHeaderCollection.Split方法的典型用法代码示例。如果您正苦于以下问题:C# WebHeaderCollection.Split方法的具体用法?C# WebHeaderCollection.Split怎么用?C# WebHeaderCollection.Split使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Net.WebHeaderCollection
的用法示例。
在下文中一共展示了WebHeaderCollection.Split方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: UploadValuesTaskAsync
//.........这里部分代码省略.........
// did we not fix it already?
// android 2.3 only seems to have responseText
// https://sites.google.com/a/jsc-solutions.net/backlog/knowledge-base/2014/201404/20140413
try
{
response = Encoding.UTF8.GetBytes(x.responseText);
}
catch
{
//I/chromium(30556): [INFO:CONSOLE(37861)] "%c92:28288ms UploadValuesAsync { status = 204, responseType = arraybuffer }", source: http://192.168.43.7:4394/view-source (37861)
//I/chromium(30556): [INFO:CONSOLE(37861)] "%c92:28290ms responseText failed. thanks webview devs. { status = 204 }", source: http://192.168.43.7:4394/view-source (37861)
// X:\jsc.svn\examples\javascript\p2p\SharedBrowserSessionExperiment\SharedBrowserSessionExperiment\ApplicationWebService.cs
Console.WriteLine("responseText failed? " + new { x.status });
}
}
else
{
// http://stackoverflow.com/questions/8022425/getting-blob-data-from-xhr-request
var a = (ArrayBuffer)x.response;
//Console.WriteLine("UploadValuesAsync " + new { x.status, x.responseType, a.byteLength });
// IE?
//var u8 = new Uint8Array(array: a);
// X:\jsc.svn\core\ScriptCoreLib.Async\ScriptCoreLib.Async\JavaScript\DOM\FileEntryAsyncExtensions.cs
var u8c = new Uint8ClampedArray(array: a);
response = u8c;
}
//Console.WriteLine("UploadValuesAsync " + new { x.status, x.responseType, response });
#region ResponseHeaders
this.ResponseHeaders = new WebHeaderCollection();
//this.ResponseHeaders.Clear();
var ResponseHeaders = x.getAllResponseHeaders();
// Z:\jsc.svn\examples\javascript\Test\TestAfterInvokeResponseHeaders\ApplicationWebService.cs
//Console.WriteLine("after WebClient.UploadValuesTaskAsync! " + new { ResponseHeaders });
//0:8209ms { ResponseHeaders = Date: Sat, 15 Mar 2014 12:25:45 GMT
//Server: ASP.NET Development Server/11.0.0.0
//X-AspNet-Version: 4.0.30319
//ETag: BqShORsRkdny750pWBdVyQ==
//X-ElapsedMilliseconds: 10
//Content-Type: text/xml; charset=utf-8
//Access-Control-Allow-Origin: *
//Cache-Control: private
//Connection: Close
//Content-Length: 239
foreach (var item in ResponseHeaders.Split('\n'))
{
var u = item.IndexOf(":");
if (u > 0)
{
var ukey = item.Substring(0, u);
var uvalue = item.Substring(u + 1).Trim();
//Console.WriteLine(new { ukey, uvalue });
this.ResponseHeaders[ukey] = uvalue;
}
}
#endregion
//Console.WriteLine(new { ResponseHeaders });
r.SetResult(response);
#endregion
}
);
x.responseType = "arraybuffer";
// Z:\jsc.svn\examples\javascript\ubuntu\UbuntuSSLWebApplication\UbuntuSSLWebApplication\Application.cs
// allow basejump?
// breaks Task<> call?
//x.responseType = "text";
// is IE actually sending it? or is our server decoding it wrong?
//Console.WriteLine("WebClient.UploadValuesAsync IXMLHttpRequest " + new { xFormDataString });
x.send(xFormDataString);
return r.Task;
}