草庐IT

CURRENT_SHA

全部标签

c# - 使用 HMAC-SHA1 加密创建 OAuth 签名返回 HTTP 401

问题我需要对需要OAuth加密的API进行身份验证。我的方向是正确的,但我确信我的签名基本字符串有问题。由于HMACSHA1哈希基于key和BaseString,因此我得到了错误的oauth_signature。OAuthSigningProcess到目前为止我已经能够收集到所有必需的数据,其中包括:ConsumerKeyConsumerSecretAccesTokenAccesSecretSha1HasedValue(BasedonKeyandMessage,whereMessageisthesignatureBasestring)SignatureBaseString问题由于签名无

c# - HttpContext.Current.Request.UserHostAddress 为空

在我的开发机器中HttpContext.Current.Request.UserHostAddress为空。为什么?我怎样才能打开它?如果是代理客户端,如何获取Ips列表?WCF服务与ASP.net4window7。谢谢 最佳答案 为避免此问题,您可以解析最后输入IP的HTTP_X_FORWARDED_FOR。ip=Request.ServerVariables["HTTP_X_FORWARDED_FOR"];if(!string.IsNullOrEmpty(ip)){string[]ipRange=ip.Split(',');in

c# - "The breakpoint will not currently be hit. A copy of file was found in dll file, but the current source code is different"

我不断收到此错误消息,提示存在.cs文件的副本,因此不会命中断点。我尝试过清理解决方案、重建、删除obj和bin文件夹中的.pdb文件、关闭VS并重新启动它、重新启动整个机器(这是Windows!有时最复杂、无法解释的问题会像这样解决:\)知道我还能尝试什么吗?这是VS2015上的.net项目 最佳答案 我发现了问题,原来IIS配置为使用我备份文件夹中项目的不同副本。这听起来很傻,但如果有人有类似的问题,我会保留这个问题。 关于c#-"Thebreakpointwillnotcurren

c# - 如何在 C# 中使用 PBKDF2 HMAC SHA-256 或 SHA-512 使用 salt 和迭代对密码进行哈希处理?

我想找到一种解决方案或方法,允许我添加盐并控制迭代次数。nativeRfc2898DeriveBytes基于HMACSHA1。理想情况下,使用SHA-256或SHA-512将使系统经得起future考验。这是迄今为止我找到的最好的例子:http://jmedved.com/2012/04/pbkdf2-with-sha-256-and-others/但是当我用SHA-256运行它时,它实际上比SHA-512慢。我使用了64k次迭代、salt的guid和不同的相同长度的密码来进行比较。我还找到了这个解决方案:http://sourceforge.net/projects/pwdtknet

c# - RSACryptoServiceProvider(.NET 的 RSA)可以使用 SHA256 代替 SHA1 进行加密(不签名)吗?

加密时,RSACryptoServiceProvider(或.NET提供的任何其他RSA加密器)能否使用SHA256而不是SHA1?SHA1似乎是硬编码的,无法更改。例如,RSACryptoServiceProvider.SignatureAlgorithm被硬编码为返回“http://www.w3.org/2000/09/xmldsig#rsa-sha1”。如果没有办法让RSACryptoServiceProvider使用SHA256,有什么替代方案?更新以下代码运行良好,但我想将OAEPWithSHA1AndMGF1Padding更改为OAEPWithSHA256AndMGF1Pa

c# - 异步任务中的 HttpContext.Current null

我有一个使用存储库的方法(userRepo):publicoverrideTaskCreateLocalUserAsync(IUseruser,stringpassword,CancellationTokencancellationToken){vartask=newTask(()=>{TUserEntitynewUser=newTUserEntity{Id=user.Id,UserName=user.UserName,Password=password};userRepo.Save(newUser).Flush();returnnewIdentityResult(true);},ca

c# - HttpContext.Current.Cache 是线程安全的吗?

请检查下面的代码:objDDLTable=HttpContext.Current.Cache["TestSet"]asHashtable;if(objDDLTable==null){objDDLTable=newHashtable();arrDDLItems=GetDropDownList("testDropDown");objDDLTable.Add("testDropDown",arrDDLItems);HttpContext.Current.Cache["TestSet"]=objDDLTable;}elseif(objDDLTable!=null&&!objDDLTable.C

c# - 使用最小起订量模拟 HttpContext.Current.Server.MapPath?

我正在对我的家庭Controller进行单元测试。在我添加保存图像的新功能之前,此测试运行良好。导致问题的方法如下所示。publicstaticvoidSaveStarCarCAPImage(intcapID){byte[]capBinary=Motorpoint2011Data.RetrieveCapImageData(capID);if(capBinary!=null){MemoryStreamioStream=newMemoryStream();ioStream=newMemoryStream(capBinary);//savethememorystreamasanimage//

c# - LinqToSQL 错误 : Operation is not valid due to the current state of the object

在更新命令期间,我收到以下错误:Operationisnotvalidduetothecurrentstateoftheobject我试图从更新命令中删除一列并且它工作正常。此列是一个FK,与其他工作正常的FK相似。这是执行更新的代码:ti.NumeroTitolo=titolo.Numero;ti.RKTipoTitoloGenereTitolo=titolo.RkTipoTitoloGenereTitolo;ti.RKBanca=titolo.RkBanca;ti.DataScadenza=titolo.DataScadenza;ti.RKTipoEsito=titolo.RkTi

c# - 扩展 ASP.NET 身份角色 : IdentityRole is not part of the model for the current context

我正在尝试在我的MVC5应用程序中使用新的ASP.NETIdentity,特别是我正在尝试将ASP.NETIdentity集成到现有数据库中。我已经阅读了有关DBFirst和ASP.NETIdentity的SO问题/答案,并且遵循了所有建议我仍然无法向我的数据库添加角色,尽管我在添加用户时没有问题。这是我的代码:varcontext=newPayrollDBEntities();varroleManager=newRoleManager(newRoleStore(context));boolroleExists=roleManager.RoleExists(roleDto.Name);