本文整理汇总了C#中WebExceptionStatus类的典型用法代码示例。如果您正苦于以下问题:C# WebExceptionStatus类的具体用法?C# WebExceptionStatus怎么用?C# WebExceptionStatus使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
WebExceptionStatus类属于命名空间,在下文中一共展示了WebExceptionStatus类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: WebException
internal WebException(string message, string data, Exception innerException, WebExceptionStatus status, WebResponse response, WebExceptionInternalStatus internalStatus) : base(message + ((data != null) ? (": '" + data + "'") : ""), innerException)
{
this.m_Status = WebExceptionStatus.UnknownError;
this.m_Status = status;
this.m_Response = response;
this.m_InternalStatus = internalStatus;
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:7,代码来源:WebException.cs
示例2: ConnectionException
/// <summary>
/// Represents errors that occur during application execution
/// </summary>
/// <param name="message">The message that describes the error</param>
/// <param name="response">The response from server</param>
/// <param name="status">The <see cref="System.Net.WebExceptionStatus"/> that triggered this exception.</param>
/// <param name="request">HTTP request sent by this SDK.</param>
public ConnectionException(string message, string response, WebExceptionStatus status, HttpWebRequest request)
: base(message)
{
this.Response = response;
this.WebExceptionStatus = status;
this.Request = request;
}
开发者ID:santhign,项目名称:PayPal-NET-SDK,代码行数:14,代码来源:ConnectionException.cs
示例3: InitOption
private void InitOption(HttpStatus status, HttpCause cause)
{
this.mStatus = status;
this.mCause = cause;
this.mHttpErrorResponse = null;
this.mWebStatus = WebExceptionStatus.Success;
}
开发者ID:huamanhtuyen,项目名称:VNACCS,代码行数:7,代码来源:HttpExceptionEx.cs
示例4: BeginMultipleWrite
internal override IAsyncResult BeginMultipleWrite(BufferOffsetSize[] buffers, AsyncCallback callback, object state)
{
IAsyncResult result2;
if (!this.m_Worker.IsAuthenticated)
{
BufferAsyncResult result = new BufferAsyncResult(this, buffers, state, callback);
if (this.ProcessAuthentication(result))
{
return result;
}
}
try
{
result2 = this.m_Worker.SecureStream.BeginWrite(buffers, callback, state);
}
catch
{
if (this.m_Worker.IsCertValidationFailed)
{
this.m_ExceptionStatus = WebExceptionStatus.TrustFailure;
}
else if (this.m_Worker.LastSecurityStatus != SecurityStatus.OK)
{
this.m_ExceptionStatus = WebExceptionStatus.SecureChannelFailure;
}
else
{
this.m_ExceptionStatus = WebExceptionStatus.SendFailure;
}
throw;
}
return result2;
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:33,代码来源:TlsStream.cs
示例5: TlsStream
//
// This version of an Ssl Stream is for internal HttpWebrequest use.
// This Ssl client owns the underlined socket
// The TlsStream will own secured read/write and disposal of the passed "networkStream" stream.
//
public TlsStream(string destinationHost, NetworkStream networkStream, X509CertificateCollection clientCertificates, ServicePoint servicePoint, object initiatingRequest, ExecutionContext executionContext)
:base(networkStream, true) {
// WebRequest manages the execution context manually so we have to ensure we get one for SSL client certificate demand
_ExecutionContext = executionContext;
if (_ExecutionContext == null)
{
_ExecutionContext = ExecutionContext.Capture();
}
//
GlobalLog.Enter("TlsStream::TlsStream", "host="+destinationHost+", #certs="+((clientCertificates == null) ? "none" : clientCertificates.Count.ToString(NumberFormatInfo.InvariantInfo)));
if (Logging.On) Logging.PrintInfo(Logging.Web, this, ".ctor", "host="+destinationHost+", #certs="+((clientCertificates == null) ? "null" : clientCertificates.Count.ToString(NumberFormatInfo.InvariantInfo)));
m_ExceptionStatus = WebExceptionStatus.SecureChannelFailure;
m_Worker = new SslState(networkStream, initiatingRequest is HttpWebRequest, SettingsSectionInternal.Section.EncryptionPolicy);
m_DestinationHost = destinationHost;
m_ClientCertificates = clientCertificates;
RemoteCertValidationCallback certValidationCallback = servicePoint.SetupHandshakeDoneProcedure(this, initiatingRequest);
m_Worker.SetCertValidationDelegate(certValidationCallback);
// The Handshake is NOT done at this point
GlobalLog.Leave("TlsStream::TlsStream (Handshake is not done)");
}
开发者ID:REALTOBIZ,项目名称:mono,代码行数:33,代码来源:_TLSstream.cs
示例6: WebException
public WebException(String msg, Exception inner,
WebExceptionStatus status, WebResponse response)
: base(msg, inner)
{
myresponse = response;
mystatus = status;
}
开发者ID:jjenki11,项目名称:blaze-chem-rendering,代码行数:7,代码来源:WebException.cs
示例7: HttpWebException
static HttpWebException()
{
#if PORTABLE
if (!Enum.TryParse("ProtocolError", out ProtocolError))
ProtocolError = WebExceptionStatus.UnknownError;
#else
ProtocolError = WebExceptionStatus.ProtocolError;
#endif
}
开发者ID:crowdy,项目名称:OpenStack-ConoHa,代码行数:9,代码来源:HttpWebException.cs
示例8: WebException
public WebException(string message,
Exception innerException,
WebExceptionStatus status,
WebResponse response)
: base (message, innerException)
{
this.status = status;
this.response = response;
}
开发者ID:henricj,项目名称:SM.Mono.Net,代码行数:9,代码来源:WebException.cs
示例9: WebException
public WebException(string message,
Exception innerException,
WebExceptionStatus status,
WebResponse response) :
base(message, innerException)
{
_status = status;
_response = response;
if (innerException != null)
{
HResult = innerException.HResult;
}
}
开发者ID:noahfalk,项目名称:corefx,代码行数:14,代码来源:WebException.cs
示例10: GetWebStatusString
internal static string GetWebStatusString(WebExceptionStatus status)
{
int index = (int) status;
if ((index >= s_Mapping.Length) || (index < 0))
{
throw new InternalException();
}
string str = s_Mapping[index];
if (str == null)
{
str = "net_webstatus_" + status.ToString();
s_Mapping[index] = str;
}
return str;
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:15,代码来源:WebExceptionMapping.cs
示例11: GetWebStatusString
/*++
GetWebStatusString - Get a WebExceptionStatus-specific resource string
This method takes an input string and a WebExceptionStatus. We use the input
string as a key to find a status message and the webStatus to produce
a status-specific message, then we combine the two.
Input:
Res - Id for resource string.
Status - The WebExceptionStatus to be formatted.
Returns:
string for localized message.
--*/
public static string GetWebStatusString(string Res, WebExceptionStatus Status) {
string Msg;
string StatusMsg;
StatusMsg = SR.GetString(WebExceptionMapping.GetWebStatusString(Status));
// Get the base status.
Msg = SR.GetString(Res);
// Format the status specific message into the base status and return
// that
return String.Format(CultureInfo.CurrentCulture, Msg, StatusMsg);
}
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:34,代码来源:_NetRes.cs
示例12: FailRequest
protected internal virtual void FailRequest(WebExceptionStatus webStatus)
{
if (Logging.On)
{
Logging.PrintError(Logging.RequestCache, SR.GetString("net_log_cache_failing_request_with_exception", new object[] { webStatus.ToString() }));
}
if (webStatus == WebExceptionStatus.CacheEntryNotFound)
{
throw ExceptionHelper.CacheEntryNotFoundException;
}
if (webStatus == WebExceptionStatus.RequestProhibitedByCachePolicy)
{
throw ExceptionHelper.RequestProhibitedByCachePolicyException;
}
throw new WebException(NetRes.GetWebStatusString("net_requestaborted", webStatus), webStatus);
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:16,代码来源:RequestCacheValidator.cs
示例13: TlsStream
public TlsStream(string destinationHost, NetworkStream networkStream, X509CertificateCollection clientCertificates, ServicePoint servicePoint, object initiatingRequest, ExecutionContext executionContext) : base(networkStream, true)
{
this.m_PendingIO = new ArrayList();
this._ExecutionContext = executionContext;
if (this._ExecutionContext == null)
{
this._ExecutionContext = ExecutionContext.Capture();
}
if (Logging.On)
{
Logging.PrintInfo(Logging.Web, this, ".ctor", "host=" + destinationHost + ", #certs=" + ((clientCertificates == null) ? "null" : clientCertificates.Count.ToString(NumberFormatInfo.InvariantInfo)));
}
this.m_ExceptionStatus = WebExceptionStatus.SecureChannelFailure;
this.m_Worker = new SslState(networkStream, initiatingRequest is HttpWebRequest, SettingsSectionInternal.Section.EncryptionPolicy);
this.m_DestinationHost = destinationHost;
this.m_ClientCertificates = clientCertificates;
RemoteCertValidationCallback certValidationCallback = servicePoint.SetupHandshakeDoneProcedure(this, initiatingRequest);
this.m_Worker.SetCertValidationDelegate(certValidationCallback);
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:19,代码来源:TlsStream.cs
示例14: Send
public static string Send(string request)
{
try
{
HttpWebRequest req = (HttpWebRequest)WebRequest.Create(request);
req.ReadWriteTimeout = 9000;
req.Timeout = 10000;
HttpWebResponse response = (HttpWebResponse)req.GetResponse();
status = KannelReqCode.SuccessfullyAccepted;
// Get the stream associated with the response.
Stream receiveStream = response.GetResponseStream();
// Pipes the stream to a higher level stream reader with the required encoding format.
StreamReader readStream = new StreamReader(receiveStream, Encoding.UTF8);
string answer = readStream.ReadLine();
//MessageBox.Show(response.StatusCode.ToString() + "\n" + readStream.ReadLine(), "SMS Sender", MessageBoxButtons.OK, MessageBoxIcon.Information);
response.Close();
readStream.Close();
return answer;
}
catch (WebException ex)
{
if (ex.Status == WebExceptionStatus.Timeout)
status = KannelReqCode.OperationTimeout;
else
status = KannelReqCode.UnknownError;
wes = ex.Status;
return ex.Message;
}
catch(Exception ex)
{
wes = WebExceptionStatus.SendFailure;
status = KannelReqCode.UnknownError;
return ex.Message;
}
}
开发者ID:0xDAD,项目名称:pr2sms,代码行数:41,代码来源:HttpReq.cs
示例15: ToRollbarStatus
private static RollbarResponseCode ToRollbarStatus(WebExceptionStatus status) {
switch ((int) status) {
case 200:
return RollbarResponseCode.Success;
case 400:
return RollbarResponseCode.BadRequest;
case 401:
return RollbarResponseCode.Unauthorized;
case 403:
return RollbarResponseCode.AccessDenied;
case 413:
return RollbarResponseCode.RequestTooLarge;
case 422:
return RollbarResponseCode.UnprocessablePayload;
case 429:
return RollbarResponseCode.TooManyRequests;
case 500:
return RollbarResponseCode.InternalServerError;
default:
throw new ArgumentException("Invalid Status returned from Rollbar", "status");
}
}
开发者ID:l8nightcaffeine,项目名称:Nancy.Rollbar,代码行数:22,代码来源:RollbarPayloadSender.cs
示例16: RESTResponse
internal RESTResponse(HttpWebResponse response, long elapsedTime = 0, string error = null, WebExceptionStatus errorStatus = WebExceptionStatus.Success)
{
if (!object.ReferenceEquals(response, null))
{
this.Content = this.GetContent(response);
this.ContentEncoding = response.ContentEncoding;
this.ContentLength = response.ContentLength;
this.ContentType = response.ContentType;
this.Cookies = response.Cookies;
this.Headers = response.Headers;
this.ResponseStatus = response.StatusCode.ToString();
this.ResponseUri = response.ResponseUri;
this.ReturnedError = (this.ErrorStatus.Equals(WebExceptionStatus.Success)) ? false : true;
this.Server = response.Server;
this.StatusCode = response.StatusCode;
this.StatusDescription = response.StatusDescription;
}
this.ElapsedTime = elapsedTime;
this.Error = error;
this.ErrorStatus = errorStatus;
}
开发者ID:yuyobit,项目名称:Grapevine,代码行数:22,代码来源:RESTResponse.cs
示例17: GetWebStatusString
/*++
GetWebStatusString - Get a WebExceptionStatus-specific resource string
This method takes an input string and a WebExceptionStatus. We use the input
string as a key to find a status message and the webStatus to produce
a status-specific message, then we combine the two.
Input:
Res - Id for resource string.
Status - The WebExceptionStatus to be formatted.
Returns:
string for localized message.
--*/
public static string GetWebStatusString(string Res, WebExceptionStatus Status) {
string Msg;
string StatusEnumName;
string StatusMsg;
// First, convert the WebExceptionStatus to its label.
StatusEnumName = ((Enum)Status).ToString();
// Now combine the label with the base enum key and look up the
// status msg.
StatusMsg = SR.GetString("net_webstatus_" + StatusEnumName);
// Get the base status.
Msg = SR.GetString(Res);
// Format the status specific message into the base status and return
// that
return String.Format(Msg, StatusMsg);
}
开发者ID:ArildF,项目名称:masters,代码行数:42,代码来源:_netres.cs
示例18: WebException
public WebException(string message, WebExceptionStatus status)
: base(message)
{
this.status = status;
}
开发者ID:nguyenkien,项目名称:api,代码行数:5,代码来源:WebException.cs
示例19: CreateStream
internal Stream CreateStream (byte[] buffer)
{
sslStream = provider.CreateSslStream (networkStream, false, settings);
try {
sslStream.AuthenticateAsClient (
request.Address.Host, request.ClientCertificates,
(SslProtocols)ServicePointManager.SecurityProtocol,
ServicePointManager.CheckCertificateRevocationList);
status = WebExceptionStatus.Success;
} catch (Exception ex) {
status = WebExceptionStatus.SecureChannelFailure;
throw;
} finally {
if (CertificateValidationFailed)
status = WebExceptionStatus.TrustFailure;
if (status == WebExceptionStatus.Success)
request.ServicePoint.UpdateClientCertificate (sslStream.InternalLocalCertificate);
else {
request.ServicePoint.UpdateClientCertificate (null);
sslStream = null;
}
}
try {
if (buffer != null)
sslStream.Write (buffer, 0, buffer.Length);
} catch {
status = WebExceptionStatus.SendFailure;
sslStream = null;
throw;
}
return sslStream.AuthenticatedStream;
}
开发者ID:Numpsy,项目名称:mono,代码行数:37,代码来源:MonoTlsStream.cs
示例20: MonoTlsStream
public MonoTlsStream (HttpWebRequest request, NetworkStream networkStream)
{
this.request = request;
this.networkStream = networkStream;
settings = request.TlsSettings;
provider = request.TlsProvider ?? MonoTlsProviderFactory.GetProviderInternal ();
status = WebExceptionStatus.SecureChannelFailure;
validationHelper = ChainValidationHelper.Create (provider.Provider, ref settings, this);
}
开发者ID:Numpsy,项目名称:mono,代码行数:11,代码来源:MonoTlsStream.cs
注:本文中的WebExceptionStatus类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论