草庐IT

ignore-certificate-errors

全部标签

c# - 从 Azure Websites for Google API 中的 p12 证书生成 X509Certificate2 时出现 502 错误

我正在使用ThisGoogleJsonWebToken类以生成访问token,以与对GoogleCalendarAPI的json调用一起使用。当我使用以下内容(使用我的实际服务帐户电子邮件)时,它在我的开发机器上的IISExpress中工作得很好:stringp12Path=HttpContext.Current.Server.MapPath("~/App_Data/certificate.p12");varauth=GoogleJsonWebToken.GetAccessToken("uniquestring@developer.gserviceaccount.com",p12Pat

c# - 如何在 SslStream.AuthenticateAsClient 期间从 X509Certificate 对象中提取域名? (.NET4)

我有一个由SslStream.AuthenticateAsClient调用的RemoteCertificateValidationCallback函数,它传递了一个X509Certificate对象。我想从该证书中提取名称,如果我将该字符串传递给AuthenticateAsClient,它就会通过。(假设没有其他问题。)(注意:Subject属性包含域名,但它位于“CN=...,S=...”等格式的字符串中。)另请参阅:HowtoextractCNfromX509CertificateinJava?(针对Java提出了类似的问题,但我找不到这些答案中提到的.NET的类似类。)(跟进Eu

c# - .mdf"failed with the operating system error 2(系统找不到指定的文件。)

protectedvoidregister_Click(objectsender,EventArgse){AddUser(userName.Text,password.Text,confirm.Text);}voidAddUser(stringname,stringpass,stringconfirm){Useru=newUser(name,pass,confirm);if(u.Valid){using(vardb=newSiteContext()){db.User.Add(u);db.SaveChanges();}}}}publicclassUser{publicintUserId{

c# - 我想念 C# 中 Visual Basic 的 "On Error Resume Next"。我现在应该如何处理错误?

在VisualBasic中,我只在程序头部编写了OnErrorResumeNext,整个项目中的错误都被抑制了。在C#中,我非常怀念这个特性。对每个过程的常用try-catch处理不仅非常耗时,而且会带来不良影响。如果遇到错误,即使已处理,代码也不会从错误发生的地方继续。使用OnErrorResumeNext,代码从错误点继续,仅跳过导致错误的函数调用。我还没有深入了解C#,但也许C#中存在比原始try-catch更好的错误处理。我还想知道发生错误的模块或函数名称以及错误消息中的行号。据我所知,Exception类不提供该功能。任何想法(管理,当然,不涉及我自己的应用程序中的任何流程类

c# - 如何找到asp :Login LoginError error type

当asp:Login控件的LoginError事件触发时,我如何找到错误发生的原因?是否有类似e.ErrorType的属性告诉我登录失败的原因?或者我是否必须像本教程中那样手动检查所有内容:http://www.asp.net/security/tutorials/validating-user-credentials-against-the-membership-user-store-cs或http://www.aspnettutorials.com/tutorials/controls/howto-errors-login-asp4-csharp.aspx

c# - BouncyCaSTLe PrivateKey 到 X509Certificate2 PrivateKey

我使用BouncyCaSTLe创建证书varkeypairgen=newRsaKeyPairGenerator();keypairgen.Init(newKeyGenerationParameters(newSecureRandom(newCryptoApiRandomGenerator()),1024));varkeypair=keypairgen.GenerateKeyPair();vargen=newX509V3CertificateGenerator();varCN=newX509Name("CN="+certName);varSN=BigInteger.ProbablePri

c# - 如果打开自定义错误,是否不会触发 global.asax Application_Error 事件?

如果您在Web配置中将自定义错误设置为RemoteOnly-这是否意味着global.asax中的MVC应用程序级错误事件-Application_Error不会因错误而触发?我刚刚注意到,当我的应用程序出现某个错误时,我正在远程查看该站点,但没有记录任何错误。但是,当我访问服务器上的应用程序并发生相同的错误时,会记录错误。这是自定义错误配置设置:编辑只是出于人们的兴趣——我最终完全关闭了自定义错误并在Application_Error中处理重定向,如下所示:protectedvoidApplication_Error(objectsender,EventArgse){Exceptio

c# - 系统.ComponentModel.Win32Exception : Access is denied Error

我正在使用C#代码启动和停止窗口服务,但出现此错误。System.ComponentModel.Win32Exception:Accessisdenied我的代码:publicvoidStartService(stringserviceName,inttimeoutMilliseconds){ServiceControllerservice=newServiceController(serviceName);try{TimeSpantimeout=TimeSpan.FromMilliseconds(timeoutMilliseconds);service.Start();service

c# - 错误 :An unknown error occurred while invoking the service metadata component. 无法生成服务引用

当尝试使用.netcore2.1rc1为WCF添加服务引用时,我遇到以下错误:Error:Anunknownerroroccurredwhileinvokingtheservicemetadatacomponent.Failedtogenerateservicereference我已经检查过,唯一的安全措施是传输,没有消息安全措施。日志如下:[05/24/201812:28:28],59,Importingwebservicemetadata...[05/24/201812:28:28],27,Numberofserviceendpointsfound:2[05/24/201812:2

c# - 编译器错误 : "error CS0307: The variable ' int' cannot be used with type arguments"

如果我有以下代码:privatevoidCheck(boola,boolb){}privatevoidCheck(inta,intb,intc,boolflag){Check(a(flag?c:b-10));}我在调用Check(int,int)时遇到编译时错误:errorCS0307:Thevariable'int'cannotbeusedwithtypearguments我也遇到了这些错误:errorCS0118:'b'isavariablebutisusedlikeatypeerrorCS0118:'a'isavariablebutisusedlikeatype为什么会出现这些错