restsharp

AWS Cognito OAuth: Login request failure

安稳与你 提交于 2020-06-01 06:00:18
问题 I want to skip AWS Cognito's Hosted UI for login/authorization. However, when I try to consume the login end point to fetch authorization-code, I'm slapped with MethodNotAllowed response. As per AWS documentation, the login end-point accepts " Get " requests only. Based on my research on this topic, I figured it was possible to use " Post " method with login credentials for the login end point (Thanks to AWS documentation). Can someone help please me figure out the issue? AWS Pool Settings:

CredentialCache.DefaultCredentials isn't respecting IIS App Pool Credentials with dotnet core 2.2

梦想与她 提交于 2020-05-13 17:52:58
问题 I need to make a web request from WebServiceA running as ServiceAccountA to WebServiceB and have it authenticate using NTLM. Both web services are dotnet core 2.2 APIs hosted in IIS. ServiceAccountA is the service account set on the IIS App Pool. Just to be clear, I am NOT doing impersonation. I'm using the RestSharp library to make HttpClient requests. See NTLM Authenticator: https://github.com/restsharp/RestSharp/blob/master/RestSharp/Authenticators/NtlmAuthenticator.cs The NTLM

CredentialCache.DefaultCredentials isn't respecting IIS App Pool Credentials with dotnet core 2.2

孤街浪徒 提交于 2020-05-13 17:51:48
问题 I need to make a web request from WebServiceA running as ServiceAccountA to WebServiceB and have it authenticate using NTLM. Both web services are dotnet core 2.2 APIs hosted in IIS. ServiceAccountA is the service account set on the IIS App Pool. Just to be clear, I am NOT doing impersonation. I'm using the RestSharp library to make HttpClient requests. See NTLM Authenticator: https://github.com/restsharp/RestSharp/blob/master/RestSharp/Authenticators/NtlmAuthenticator.cs The NTLM

RestSharp AddFile Using Stream

萝らか妹 提交于 2020-05-08 06:33:36
问题 I am using RestSharp (version 105.2.3.0 in Visual Studio 2013, .net 4.5) to call a NodeJS hosted webservice. One of the calls I need to make is to upload a file. Using a RESTSharp request, if I retrieve the stream from my end into a byte array and pass that to AddFile, it works fine. However, I would much rather stream the contents and not load up entire files in server memory (the files can be 100's of MB). If I set up an Action to copy my stream (see below), I get an exception at the

RestSharp AddFile Using Stream

风格不统一 提交于 2020-05-08 06:32:48
问题 I am using RestSharp (version 105.2.3.0 in Visual Studio 2013, .net 4.5) to call a NodeJS hosted webservice. One of the calls I need to make is to upload a file. Using a RESTSharp request, if I retrieve the stream from my end into a byte array and pass that to AddFile, it works fine. However, I would much rather stream the contents and not load up entire files in server memory (the files can be 100's of MB). If I set up an Action to copy my stream (see below), I get an exception at the

RestSharp AddFile Using Stream

落花浮王杯 提交于 2020-05-08 06:32:43
问题 I am using RestSharp (version 105.2.3.0 in Visual Studio 2013, .net 4.5) to call a NodeJS hosted webservice. One of the calls I need to make is to upload a file. Using a RESTSharp request, if I retrieve the stream from my end into a byte array and pass that to AddFile, it works fine. However, I would much rather stream the contents and not load up entire files in server memory (the files can be 100's of MB). If I set up an Action to copy my stream (see below), I get an exception at the

.Net C#向远程服务器Api上传文件

谁都会走 提交于 2020-04-28 20:10:07
Api服务代码一: /// <summary> /// 服务器接收接口 /// </summary> [HttpPost] [Route( " ReceiveFile " )] public HttpResponseMessage ReceiveFile() { string result = string .Empty; ArrayList list = new ArrayList(); try { Stream postStream = HttpContext.Current.Request.InputStream; byte [] b = new byte [postStream.Length]; string postFileName = DNTRequest.GetString( " fileName " ); if ( string .IsNullOrEmpty(postFileName) && HttpContext.Current.Request[ " fileName " ] != null ) { postFileName = HttpContext.Current.Request[ " fileName " ]; } string fileExtension = Path.GetExtension(postFileName); string dirName =

C#使用FtpWebRequest 基础连接已经关闭:连接被意外关闭(The underlying connection was closed:The connection was close...

生来就可爱ヽ(ⅴ<●) 提交于 2020-04-21 05:55:27
 公司内部开发的winform程序使用了FtpWebRequest下载FTP服务器的文件到本地。 大多数人运行良好,由于我们是试运行逐步有人加入到平台的使用,前两天突然有个别机器无法连接FTP服务器报出了如下错误。 The underlying connection was closed:The connection was closed unexpectedly 进行排查没有发现异常,windows事件管理器中查看也没有相关的错误。写的代码也没有发现什么不对的地方 FtpWebRequest reqFtp = (FtpWebRequest)FtpWebRequest.Create(new Uri(url)); reqFtp.UseBinary = true; reqFtp.Credentials = new NetworkCredential(FTPUSERNAME, FTPPASSWORD); FtpWebResponse response = (FtpWebResponse)reqFtp.GetResponse(); Stream ftpStream = response.GetResponseStream(); int bufferSize = 2048; int readCount; byte[] buffer = new byte[bufferSize];

RestSharp HttpBasicAuthentication - example

为君一笑 提交于 2020-03-18 10:32:50
问题 I have a WPF client using RestSharp and WEB API Service. I try to use HttpBasicAuthenticator as follows: RestRequest login = new RestRequest("/api/users/login", Method.POST); var authenticator = new HttpBasicAuthenticator("admin","22"); authenticator.Authenticate(Client, login); IRestResponse response = Client.Execute(login); The POST request looks like this: POST http://localhost/api/users/login HTTP/1.1 Authorization: Basic YWRtaW46MjI= Accept: application/json, application/xml, text/json,

RestSharp:C#的http辅助类

柔情痞子 提交于 2020-02-24 23:47:09
1.RestSharp的介绍 RestSharp是一个轻量级的,不依赖任何第三方的组件或者类库的Http的组件 优势: 通过NuGet方便引入到任何项目( 注意要与framework框架匹配,我匹配的是framework4.8ok,4.0失败了 ) 可以自动反序列化XML和JSON 支持自定义的序列化与反序列化 自动检测返回的内容类型 支持HTTP的GET, POST, PUT, HEAD, OPTIONS, DELETE等操作 可以上传多文件 支持异步操作 极易上手并应用到任何项目中 2.官方应用示例 //构建客户端对象 var client = new RestClient("http://example.com"); // client.Authenticator = new HttpBasicAuthenticator(username, password); //构建post请求 var request = new RestRequest("resource/{id}", Method.POST); request.AddUrlSegment("id", "123"); // 替换请求中的标记 // 设置请求头部删除 request.AddHeader("header", "value"); // add files to upload (works with