草庐IT

mpi_request

全部标签

c# - Google OAuth2 服务帐户访问 token 请求提供 'Invalid Request' 响应

我正在尝试通过服务器到服务器方法与我的应用启用的BigQueryAPI进行通信。我已勾选此Googleguide上的所有方框在C#中尽我所能构建我的JWT。我已经对所有必要的内容进行了Base64Url编码。但是,我从google得到的唯一响应是400BadRequest"error":"invalid_request"我已经从这些其他SO问题中确定了以下所有内容:ThesignatureisproperlyencryptedusingRSAandSHA256IamusingPOSTandusingapplication/x-www-form-urlencodedcontenttype

c# - 安全异常 : Request for the permission of type 'System.Net.Mail.SmtpPermission'

这是“在本地工作,在服务器上不工作”的帖子之一。我有一个发送电子邮件的简单联系表单。在服务器上,我得到以下异常:SecurityExceptionDescription:Theapplicationattemptedtoperformanoperationnotallowedbythesecuritypolicy.Tograntthisapplicationtherequiredpermissionpleasecontactyoursystemadministratororchangetheapplication'strustlevelintheconfigurationfile.Ex

c# - 使用 WebClient 和 C#,即使响应为 (400) Bad Request,我如何获取返回的数据?

我正在使用GoogleTranslateAPI并trycatch当我收到error时返回的数据.(仅供引用:我知道APIkey是错误的,我只是在测试它)。问题是浏览器,您可以通过单击链接看到,显示错误信息,但C#抛出WebException,我似乎无法获得响应数据。这是我的代码:stringurl="https://www.googleapis.com/language/translate/v2?key=INSERT-YOUR-KEY&source=en&target=de&q=Hello%20world";WebClientclnt=newWebClient();//Getstrin

c# - System.Web.Http.ApiController.get_Request() 中缺少方法

我有一个Controller。publicsealedclassAccountsController:BaseApiController{privatereadonlyIDatabaseAdapter_databaseAdapter;publicAccountsController(IDatabaseAdapterdatabaseAdapter){_databaseAdapter=databaseAdapter;}[AllowAnonymous][Route("create")]publicasyncTaskCreateUser(CreateUserBindingModelcreate

c# - fiddler /C# : search content of request/response for special phrases

这是我第一次访问stackoverflow,现在我对这个网站感到非常满意。它已经帮助我获得了FiddlerCore嵌入到MSVisualC#2008ExpressEdition中。只需要在MSVisualC#EE中从项目资源管理器(Projektmappenexplorer)创建对fiddlercoredll的引用(Verweis)。希望这是它在英文版中的名称。在此之后,您可以使用Fiddler.FiddlerApplication等。我的任务是什么?我想创建一个小程序,它能够使用FiddlerCore检查特殊JavaScript代码的请求/响应主体。这使开发人员能够检查他们的代码在其

c# - Request.Url.Query 和 Request.QueryString 有什么区别?

我一直在追踪一个关于UrlRewriting应用程序的错误。该错误表现为查询字符串中某些变音符号的编码问题。基本上,问题是基本上是/search.aspx?search=heřmánek的请求被重写为“search=he%c5%99m%c3%a1nek”的查询字符串正确的值(使用一些不同的工作代码)是将查询字符串重写为“search=he%u0159m%u00e1nek”注意两个字符串之间的区别。但是,如果您将两者都发布,您将看到Url编码重现相同的字符串。直到您使用context.Rewrite函数,编码才会中断。损坏的字符串返回“heÅmánek”(使用Request.QueryS

c# - 调用 HttpContext.Request 时如何避免 HttpException?

所以HttpContext.Request如果在全局启动内调用则抛出publicHttpRequestget_Request(){if(this.HideRequestResponse){thrownewHttpException(SR.GetString("Request_not_available"));}returnthis._request;}这实际上是有记录的ASP.NETwillthrowanexceptionifyoutrytousethispropertywhentheHttpRequestobjectisnotavailable.Forexample,thiswoul

c# - 值不能为空。参数名称 : request

我正在使用nunit创建单元测试,所有这些代码在运行时都运行良好。我在下面有这个protectedHttpResponseMessage代码,当它返回时我的Controller正在调用它。但是,报错:"Valuecannotbenull.Parametername:request"isdisplaying.当我检查请求时,它实际上是null。问题:我将如何编写单元测试代码以返回HttpResponseMessage?错误显示在这一行:protectedHttpResponseMessageCreated(Tresult)=>Request.CreateResponse(HttpStat

c# - 检查 Request.IsAjaxRequest 在我的 asp.net mvc4 中总是返回 false

我的Controller中有以下代码publicActionResultIndex(stringsearchTerm=null){System.Threading.Thread.Sleep(5000);varaccountdefinition=repository.FindAccountDefinition(searchTerm).ToList();if(Request.IsAjaxRequest()){returnPartialView("_CustomerTable",accountdefinition);}returnView(accountdefinition);}但如果我使用

c# - 无法上传到 Azure Blob 存储 : The remote server returned an error: (400) Bad Request

我正在尝试创建一个实用程序来从Internet下载文件并将其再次上传到Azureblob存储。Blob容器已经创建好了;但出于某种原因,当我尝试将文件上传到存储时出现“BadRequest400”异常......创建了容器名称,小写字母,特殊字符。但我仍然不知道为什么会出现异常!请帮忙。注意:我没有使用任何模拟器...直接在云端进行测试。我的所有容器都具有“公共(public)容器”访问选项。异常(exception)情况:Anexceptionoftype'Microsoft.WindowsAzure.Storage.StorageException'occurredinMicros