草庐IT

EXTERNAL_CONTENT_URI

全部标签

c# - HttpRequest.Content.IsMimeMultipartContent() 在应该返回 true 时返回 false

我需要将HTTP请求作为MultiPartFormData发送到RESTController。它正在工作,但现在我对我的Controller进行的检查声称请求的类型不正确,即使我可以在调试器中看到请求的类型正确。供引用:这是调用它的控制台应用程序代码:usingSystem;usingSystem.IO;usingSystem.Net.Http;usingSystem.Net.Http.Headers;usingSystem.Text;namespaceQuickUploadTestHarness{classProgram{staticvoidMain(string[]args){us

c# - Web Api 请求抛出 "Error while copying content to a stream."

我正在尝试实现这个codeexample,但得到一个HttpRequestException-“将内容复制到流时出错。”当调用ReadAsStringAsync()方法时。内部异常是“无法访问已处置的对象”。我正在使用Fiddler来发出请求。我不明白。有人可以解释为什么我会收到此异常并提供解决方案吗?网络API方法:publicasyncTaskPost(HttpRequestMessagerequest){try{varjsonString=awaitrequest.Content.ReadAsStringAsync();}catch(Exceptionex){throw;}ret

c# - 使用 URI 类时保持 url 编码

我正在尝试从LinkedIn获取公开个人资料信息。为此,我必须提供http://api.linkedin.com/v1/people/url=public-profile-url,其中public-profile-url必须经过URL编码。问题是HttpClient、WebRequest等.NET类使用的Uri类似乎“规范化”了所提供的URL,因此我无法发送格式正确的请求。URI必须是:http://api.linkedin.com/v1/people/url=http%3a%2f%2fwww.linkedin.com%2fin%2fiftachragoler但是是:http://ap

c# - 设置 "Always copy to output directory"时,Content 和 None 有什么区别?

在csproj文件中,我们可以使用None或Content元素包含一个文件。来自MSDN,它说:None-Thefileisnotincludedintheprojectoutputgroupandisnotcompiledinthebuildprocess.Anexampleisatextfilethatcontainsdocumentation,suchasaReadmefile.Content-Thefileisnotcompiled,butisincludedintheContentoutputgroup.Forexample,thissettingisthedefaultva

c# - WebRequest 在 ASP.NET 应用程序中失败并显示 "414 Request URI too long"

我们有一个ASP.NET应用程序,它在将报告参数作为WebRequest传递后请求HTML格式的SSRS2005报告。应用程序仅在请求具有大量多选参数的报告时失败,在webRequest.GetResponse()行抛出“414:请求URI太长”错误。用于发出请求的代码是:HttpWebRequestwebRequest=null;HttpWebResponsewebResponse=null;stringwebRequestURL=_ReportManager.GetRSUrl(reportID);//thispassesthereportlinkontheSSRSserver//m

c# - 无效的 URI : The Authority/Host could not be parsed from very long url

这是Youtube视频的实际url,此时如果您复制到您的chrome浏览器,您可以观看该视频。但是,当我尝试创建请求时,我得到了UriFormatException。我做错了什么?HttpWebRequestrequest=(HttpWebRequest)HttpWebRequest.Create(url);http:/r6---sn-x5jjxnn-ogul.googlevideo.com/videoplayback?ratebypass=yes&ms=au&fexp=924615,912522,932260,910207,936330,916611,936117,936910,93

c# - C#中URI类型文件路径的驱动器号

从URI类型的文件路径(例如)获取驱动器号的最简单方法是什么file:///D:/Directory/File.txt我知道我能做到(这里的路径是一个包含上面文本的字符串)path=path.Replace(@"file:///",String.Empty);path=System.IO.Path.GetPathRoot(path);但感觉有点笨拙。有没有办法不使用String.Replace或类似的方法来做到这一点? 最佳答案 varuri=newUri("file:///D:/Directory/File.txt");if(ur

c# - Windows Phone 8 上存在哪些 URI 协议(protocol)?

我在网上搜索了完整的URI协议(protocol)列表(XXX://),以便在WindowsPhone8中打开不同的应用程序。我找到了一些列表,但只有很少的协议(protocol)。我在这篇wiki帖子中希望制作一份完整的协议(protocol)列表,并至少涵盖WindowsPhone8中的所有常用应用程序。有很多部分列表例如:http://developer.nokia.com/Community/Wiki/URI_Association_Schemes_Listhttp://msdn.microsoft.com/en-us/library/windowsphone/develop/

c# - 错误 (HttpWebRequest) : Bytes to be written to the stream exceed the Content-Length bytes size specified

我似乎无法弄清楚为什么我不断收到以下错误:BytestobewrittentothestreamexceedtheContent-Lengthbytessizespecified.在以下行:writeStream.Write(bytes,0,bytes.Length);这是一个Windows窗体项目。如果有人知道这里发生了什么,我肯定会欠你一个。privatevoidPost(){HttpWebRequestrequest=null;Uriuri=newUri("xxxxx");request=(HttpWebRequest)WebRequest.Create(uri);request

c# - 如何获取存储在资源中的图像的 Uri

我有两个.png文件添加到我的资源中,我需要在进行绑定(bind)时访问它们的Uri。我的xaml代码如下:并且使用ImagePath的绑定(bind)代码是:ImagePath=resultInBinary.StartsWith("1")?Properties.Resources.LedGreen:Properties.Resources.ledRed;不过Properties.Resources.LedGreen返回一个Bitmap而不是包含该特定图像的Uri的String。我只想知道如何提取该值,而无需在存储的目录中寻址图像的路径。(老实说,我不确定这样做是否正确,因为我在网上找