HttpStatusCode Výčet
Definice
Obsahuje hodnoty stavových kódů definovaných pro protokol HTTP.Contains the values of status codes defined for HTTP.
public enum class HttpStatusCode
public enum HttpStatusCode
type HttpStatusCode =
Public Enum HttpStatusCode
- Dědičnost
Pole
| Accepted | 202 | Odpovídá stavu HTTP 202.Equivalent to HTTP status 202. Acceptedindikuje, že žádost byla přijata k dalšímu zpracování.Accepted indicates that the request has been accepted for further processing. |
| AlreadyReported | 208 | Odpovídá stavu HTTP 208.Equivalent to HTTP status 208. AlreadyReportedoznačuje, že členové vazby protokolu WebDAV již byly výčtem v předchozí části odpovědi na více stavů a nebudou zahrnuty znovu.AlreadyReported indicates that the members of a WebDAV binding have already been enumerated in a preceding part of the multistatus response, and are not being included again. |
| Ambiguous | 300 | Odpovídá stavu HTTP 300.Equivalent to HTTP status 300. Ambiguousoznačuje, že požadované informace mají více reprezentace.Ambiguous indicates that the requested information has multiple representations. Výchozí akce je zacházet s tímto stavem jako přesměrování a postupovat podle obsahu záhlaví umístění přidruženého k této odpovědi.The default action is to treat this status as a redirect and follow the contents of the Location header associated with this response. |
| BadGateway | 502 | Odpovídá stavu HTTP 502.Equivalent to HTTP status 502. BadGatewayindikuje, že zprostředkující proxy server přijal chybnou odpověď z jiného proxy serveru nebo ze zdrojového serveru.BadGateway indicates that an intermediate proxy server received a bad response from another proxy or the origin server. |
| BadRequest | 400 | Odpovídá stavu HTTP 400.Equivalent to HTTP status 400. BadRequestindikuje, že server nemůže pochopit požadavek.BadRequest indicates that the request could not be understood by the server. BadRequestje odesláno, pokud není k dispozici žádná jiná chyba nebo pokud je přesná Chyba neznámá nebo pokud nemá vlastní kód chyby.BadRequest is sent when no other error is applicable, or if the exact error is unknown or does not have its own error code. |
| Conflict | 409 | Odpovídá stavu HTTP 409.Equivalent to HTTP status 409. Conflictoznačuje, že požadavek nebylo možné provést z důvodu konfliktu na serveru.Conflict indicates that the request could not be carried out because of a conflict on the server. |
| Continue | 100 | Odpovídá stavu HTTP 100.Equivalent to HTTP status 100. Continueindikuje, že klient může v rámci své žádosti pokračovat.Continue indicates that the client can continue with its request. |
| Created | 201 | Odpovídá stavu HTTP 201.Equivalent to HTTP status 201. Createdindikuje, že žádost vedla k vytvoření nového prostředku vytvořeného před odesláním odpovědi.Created indicates that the request resulted in a new resource created before the response was sent. |
| EarlyHints | 103 | Odpovídá stavu HTTP 103.Equivalent to HTTP status 103. EarlyHintsUrčuje klientovi, že server bude nejspíš odesílat konečnou odpověď s poli hlavičky obsaženými v informační odpovědi.EarlyHints indicates to the client that the server is likely to send a final response with the header fields included in the informational response. |
| ExpectationFailed | 417 | Odpovídá stavu HTTP 417.Equivalent to HTTP status 417. ExpectationFailedindikuje, že server nemůže splnit očekávání určenou v očekávané hlavičce.ExpectationFailed indicates that an expectation given in an Expect header could not be met by the server. |
| FailedDependency | 424 | Odpovídá stavu HTTP 424.Equivalent to HTTP status 424. FailedDependencyoznačuje, že metoda se u prostředku nedala provést, protože požadovaná akce závisí na jiné akci a tato akce se nezdařila.FailedDependency indicates that the method couldn't be performed on the resource because the requested action depended on another action and that action failed. |
| Forbidden | 403 | Odpovídá stavu HTTP 403.Equivalent to HTTP status 403. Forbiddenindikuje, že Server odmítá splnění žádosti.Forbidden indicates that the server refuses to fulfill the request. |
| Found | 302 | Odpovídá stavu HTTP 302.Equivalent to HTTP status 302. Foundoznačuje, že požadované informace jsou umístěné na identifikátoru URI, který je zadán v hlavičce umístění.Found indicates that the requested information is located at the URI specified in the Location header. Výchozí akce, pokud je tento stav přijat, je postupovat podle hlavičky umístění přidružené k odpovědi.The default action when this status is received is to follow the Location header associated with the response. Pokud byla metoda původní žádosti PUBLIKovaná, přesměrovaná žádost použije metodu GET.When the original request method was POST, the redirected request will use the GET method. |
| GatewayTimeout | 504 | Odpovídá stavu HTTP 504.Equivalent to HTTP status 504. GatewayTimeoutindikuje, že při čekání na odpověď z jiného proxy serveru nebo ze zdrojového serveru vypršel časový limit mezilehlého proxy server.GatewayTimeout indicates that an intermediate proxy server timed out while waiting for a response from another proxy or the origin server. |
| Gone | 410 | Odpovídá stavu HTTP 410.Equivalent to HTTP status 410. Goneindikuje, že požadovaný prostředek již není k dispozici.Gone indicates that the requested resource is no longer available. |
| HttpVersionNotSupported | 505 | Odpovídá stavu HTTP 505.Equivalent to HTTP status 505. HttpVersionNotSupportedindikuje, že server nepodporuje požadovanou verzi HTTP.HttpVersionNotSupported indicates that the requested HTTP version is not supported by the server. |
| IMUsed | 226 | Odpovídá stavu HTTP 226.Equivalent to HTTP status 226. IMUsedindikuje, že Server splnil požadavek na prostředek, a odpověď je reprezentace výsledku jedné nebo více manipulaci s instancemi, které byly aplikovány na aktuální instanci.IMUsed indicates that the server has fulfilled a request for the resource, and the response is a representation of the result of one or more instance-manipulations applied to the current instance. |
| InsufficientStorage | 507 | Odpovídá stavu HTTP 507.Equivalent to HTTP status 507. InsufficientStorageindikuje, že server nemůže uložit reprezentaci nutnou k dokončení žádosti.InsufficientStorage indicates that the server is unable to store the representation needed to complete the request. |
| InternalServerError | 500 | Odpovídá stavu HTTP 500.Equivalent to HTTP status 500. InternalServerErrorindikuje, že na serveru došlo k obecné chybě.InternalServerError indicates that a generic error has occurred on the server. |
| LengthRequired | 411 | Odpovídá stavu HTTP 411.Equivalent to HTTP status 411. LengthRequiredindikuje, že chybí požadovaná hlavička Content-Length.LengthRequired indicates that the required Content-length header is missing. |
| Locked | 423 | Odpovídá stavu HTTP 423.Equivalent to HTTP status 423. Lockedindikuje, že zdrojový nebo cílový prostředek je uzamčený.Locked indicates that the source or destination resource is locked. |
| LoopDetected | 508 | Odpovídá stavu HTTP 508.Equivalent to HTTP status 508. LoopDetectedindikuje, že server ukončil operaci, protože při zpracování požadavku WebDAV s "Depth: Infinity" zjistil nekonečnou smyčku.LoopDetected indicates that the server terminated an operation because it encountered an infinite loop while processing a WebDAV request with "Depth: infinity". Tento stavový kód je určen pro zpětnou kompatibilitu s klienty, kteří nevědí o stavovém kódu 208, který se zobrazuje v podmíněných základech AlreadyReported odezvy.This status code is meant for backward compatibility with clients not aware of the 208 status code AlreadyReported appearing in multistatus response bodies. |
| MethodNotAllowed | 405 | Odpovídá stavu HTTP 405.Equivalent to HTTP status 405. MethodNotAllowedoznačuje, že metoda požadavku (POST nebo GET) není u požadovaného prostředku povolena.MethodNotAllowed indicates that the request method (POST or GET) is not allowed on the requested resource. |
| MisdirectedRequest | 421 | Odpovídá stavu HTTP 421.Equivalent to HTTP status 421. MisdirectedRequestindikuje, že žádost byla směrována na serveru, který nemůže vytvořit odpověď.MisdirectedRequest indicates that the request was directed at a server that is not able to produce a response. |
| Moved | 301 | Odpovídá stavu HTTP 301.Equivalent to HTTP status 301. Movedoznačuje, že požadované informace byly přesunuty do identifikátoru URI zadaného v hlavičce umístění.Moved indicates that the requested information has been moved to the URI specified in the Location header. Výchozí akce, pokud je tento stav přijat, je postupovat podle hlavičky umístění přidružené k odpovědi.The default action when this status is received is to follow the Location header associated with the response. Pokud byla metoda původní žádosti PUBLIKovaná, přesměrovaná žádost použije metodu GET.When the original request method was POST, the redirected request will use the GET method. |
| MovedPermanently | 301 | Odpovídá stavu HTTP 301.Equivalent to HTTP status 301. MovedPermanentlyoznačuje, že požadované informace byly přesunuty do identifikátoru URI zadaného v hlavičce umístění.MovedPermanently indicates that the requested information has been moved to the URI specified in the Location header. Výchozí akce, pokud je tento stav přijat, je postupovat podle hlavičky umístění přidružené k odpovědi.The default action when this status is received is to follow the Location header associated with the response. |
| MultipleChoices | 300 | Odpovídá stavu HTTP 300.Equivalent to HTTP status 300. MultipleChoicesoznačuje, že požadované informace mají více reprezentace.MultipleChoices indicates that the requested information has multiple representations. Výchozí akce je zacházet s tímto stavem jako přesměrování a postupovat podle obsahu záhlaví umístění přidruženého k této odpovědi.The default action is to treat this status as a redirect and follow the contents of the Location header associated with this response. |
| MultiStatus | 207 | Odpovídá stavu HTTP 207.Equivalent to HTTP status 207. MultiStatusoznačuje více stavových kódů pro jednu odpověď během operace rozšíření WebDAV (Web Distributed Authoring and Versioning).MultiStatus indicates multiple status codes for a single response during a Web Distributed Authoring and Versioning (WebDAV) operation. Tělo odpovědi obsahuje kód XML, který popisuje stavové kódy.The response body contains XML that describes the status codes. |
| NetworkAuthenticationRequired | 511 | Odpovídá stavu HTTP 511.Equivalent to HTTP status 511. NetworkAuthenticationRequiredindikuje, že se klient musí ověřit, aby získal přístup k síti. je určený pro použití zachycením proxy serverů používaných k řízení přístupu k síti.NetworkAuthenticationRequired indicates that the client needs to authenticate to gain network access; it's intended for use by intercepting proxies used to control access to the network. |
| NoContent | 204 | Odpovídá stavu HTTP 204.Equivalent to HTTP status 204. NoContentindikuje, že žádost byla úspěšně zpracována a že odpověď je úmyslně prázdná.NoContent indicates that the request has been successfully processed and that the response is intentionally blank. |
| NonAuthoritativeInformation | 203 | Odpovídá stavu HTTP 203.Equivalent to HTTP status 203. NonAuthoritativeInformationoznačuje, že vrácený metainformation pochází z kopie z mezipaměti namísto zdrojového serveru, a proto může být nesprávný.NonAuthoritativeInformation indicates that the returned metainformation is from a cached copy instead of the origin server and therefore may be incorrect. |
| NotAcceptable | 406 | Odpovídá stavu HTTP 406.Equivalent to HTTP status 406. NotAcceptableindikuje, že klient označil hlavičky přijmout a nepřijme žádná z dostupných reprezentace prostředku.NotAcceptable indicates that the client has indicated with Accept headers that it will not accept any of the available representations of the resource. |
| NotExtended | 510 | Odpovídá stavu HTTP 510.Equivalent to HTTP status 510. NotExtendedindikuje, že je potřeba, aby server mohl splnit další rozšíření žádosti.NotExtended indicates that further extensions to the request are required for the server to fulfill it. |
| NotFound | 404 | Odpovídá stavu HTTP 404.Equivalent to HTTP status 404. NotFoundindikuje, že na serveru neexistuje požadovaný prostředek.NotFound indicates that the requested resource does not exist on the server. |
| NotImplemented | 501 | Odpovídá stavu HTTP 501.Equivalent to HTTP status 501. NotImplementedindikuje, že server nepodporuje požadovanou funkci.NotImplemented indicates that the server does not support the requested function. |
| NotModified | 304 | Odpovídá stavu HTTP 304.Equivalent to HTTP status 304. NotModifiedindikuje, že kopie v mezipaměti klienta je aktuální.NotModified indicates that the client's cached copy is up to date. Obsah prostředku se nepřenáší.The contents of the resource are not transferred. |
| OK | 200 | Odpovídá stavu HTTP 200.Equivalent to HTTP status 200. OKindikuje, že požadavek byl úspěšný a že požadované informace jsou v odpovědi.OK indicates that the request succeeded and that the requested information is in the response. Toto je nejběžnější stavový kód, který se má získat.This is the most common status code to receive. |
| PartialContent | 206 | Odpovídá stavu HTTP 206.Equivalent to HTTP status 206. PartialContentoznačuje, že odpověď je částečná odpověď, jak požaduje požadavek GET, který zahrnuje rozsah bajtů.PartialContent indicates that the response is a partial response as requested by a GET request that includes a byte range. |
| PaymentRequired | 402 | Odpovídá stavu HTTP 402.Equivalent to HTTP status 402. PaymentRequiredje vyhrazený pro budoucí použití.PaymentRequired is reserved for future use. |
| PermanentRedirect | 308 | Odpovídá stavu HTTP 308.Equivalent to HTTP status 308. PermanentRedirectoznačuje, že informace o žádosti se nacházejí v identifikátoru URI zadaném v hlavičce umístění.PermanentRedirect indicates that the request information is located at the URI specified in the Location header. Výchozí akce, pokud je tento stav přijat, je postupovat podle hlavičky umístění přidružené k odpovědi.The default action when this status is received is to follow the Location header associated with the response. Pokud byla metoda původní žádosti POST, přesměrovaný požadavek použije také metodu POST.When the original request method was POST, the redirected request will also use the POST method. |
| PreconditionFailed | 412 | Odpovídá stavu HTTP 412.Equivalent to HTTP status 412. PreconditionFailedindikuje, že se pro tuto žádost nastavila podmínka, která se nezdařila, a požadavek nelze provést. Podmínky jsou nastaveny pomocí hlaviček podmíněného požadavku, například If-Match, If-None-Match nebo IF-unmodified-od.PreconditionFailed indicates that a condition set for this request failed, and the request cannot be carried out. Conditions are set with conditional request headers like If-Match, If-None-Match, or If-Unmodified-Since. |
| PreconditionRequired | 428 | Odpovídá stavu HTTP 428.Equivalent to HTTP status 428. PreconditionRequiredindikuje, že server vyžaduje, aby byl požadavek podmíněný.PreconditionRequired indicates that the server requires the request to be conditional. |
| Processing | 102 | Odpovídá stavu HTTP 102.Equivalent to HTTP status 102. Processingindikuje, že server přijal kompletní požadavek, ale ještě ho nedokončil.Processing indicates that the server has accepted the complete request but hasn't completed it yet. |
| ProxyAuthenticationRequired | 407 | Odpovídá stavu HTTP 407.Equivalent to HTTP status 407. ProxyAuthenticationRequiredindikuje, že požadovaný proxy server vyžaduje ověření.ProxyAuthenticationRequired indicates that the requested proxy requires authentication. Hlavička Proxy-Authenticate obsahuje podrobnosti o tom, jak provést ověřování.The Proxy-authenticate header contains the details of how to perform the authentication. |
| Redirect | 302 | Odpovídá stavu HTTP 302.Equivalent to HTTP status 302. Redirectoznačuje, že požadované informace jsou umístěné na identifikátoru URI, který je zadán v hlavičce umístění.Redirect indicates that the requested information is located at the URI specified in the Location header. Výchozí akce, pokud je tento stav přijat, je postupovat podle hlavičky umístění přidružené k odpovědi.The default action when this status is received is to follow the Location header associated with the response. Pokud byla metoda původní žádosti PUBLIKovaná, přesměrovaná žádost použije metodu GET.When the original request method was POST, the redirected request will use the GET method. |
| RedirectKeepVerb | 307 | Odpovídá stavu HTTP 307.Equivalent to HTTP status 307. RedirectKeepVerboznačuje, že informace o žádosti se nacházejí v identifikátoru URI zadaném v hlavičce umístění.RedirectKeepVerb indicates that the request information is located at the URI specified in the Location header. Výchozí akce, pokud je tento stav přijat, je postupovat podle hlavičky umístění přidružené k odpovědi.The default action when this status is received is to follow the Location header associated with the response. Pokud byla metoda původní žádosti POST, přesměrovaný požadavek použije také metodu POST.When the original request method was POST, the redirected request will also use the POST method. |
| RedirectMethod | 303 | Odpovídá stavu HTTP 303.Equivalent to HTTP status 303. RedirectMethodautomaticky přesměruje klienta k identifikátoru URI, který je uveden v hlavičce umístění, jako výsledek příspěvku.RedirectMethod automatically redirects the client to the URI specified in the Location header as the result of a POST. Požadavek na prostředek určený hlavičkou umístění se provede pomocí GET.The request to the resource specified by the Location header will be made with a GET. |
| RequestedRangeNotSatisfiable | 416 | Odpovídá stavu HTTP 416.Equivalent to HTTP status 416. RequestedRangeNotSatisfiableoznačuje, že rozsah dat požadovaných z prostředku nelze vrátit, protože začátek rozsahu je před začátkem prostředku nebo konec rozsahu je po konci prostředku.RequestedRangeNotSatisfiable indicates that the range of data requested from the resource cannot be returned, either because the beginning of the range is before the beginning of the resource, or the end of the range is after the end of the resource. |
| RequestEntityTooLarge | 413 | Odpovídá stavu HTTP 413.Equivalent to HTTP status 413. RequestEntityTooLargeindikuje, že požadavek je pro zpracování serveru moc velký.RequestEntityTooLarge indicates that the request is too large for the server to process. |
| RequestHeaderFieldsTooLarge | 431 | Odpovídá stavu HTTP 431.Equivalent to HTTP status 431. RequestHeaderFieldsTooLargeoznačuje, že server nezpracovává požadavek, protože pole hlaviček (jednotlivá pole záhlaví nebo všechna pole záhlaví souhrnně) jsou příliš velká.RequestHeaderFieldsTooLarge indicates that the server is unwilling to process the request because its header fields (either an individual header field or all the header fields collectively) are too large. |
| RequestTimeout | 408 | Odpovídá stavu HTTP 408.Equivalent to HTTP status 408. RequestTimeoutindikuje, že klient neodeslal požadavek v době, kdy server očekával požadavek.RequestTimeout indicates that the client did not send a request within the time the server was expecting the request. |
| RequestUriTooLong | 414 | Odpovídá stavu HTTP 414.Equivalent to HTTP status 414. RequestUriTooLongoznačuje, že identifikátor URI je příliš dlouhý.RequestUriTooLong indicates that the URI is too long. |
| ResetContent | 205 | Odpovídá stavu HTTP 205.Equivalent to HTTP status 205. ResetContentindikuje, že by měl klient resetovat (nikoli znovu načíst) aktuální prostředek.ResetContent indicates that the client should reset (not reload) the current resource. |
| SeeOther | 303 | Odpovídá stavu HTTP 303.Equivalent to HTTP status 303. SeeOtherautomaticky přesměruje klienta k identifikátoru URI, který je uveden v hlavičce umístění, jako výsledek příspěvku.SeeOther automatically redirects the client to the URI specified in the Location header as the result of a POST. Požadavek na prostředek určený hlavičkou umístění se provede pomocí GET.The request to the resource specified by the Location header will be made with a GET. |
| ServiceUnavailable | 503 | Odpovídá stavu HTTP 503.Equivalent to HTTP status 503. ServiceUnavailableindikuje, že server je dočasně nedostupný, většinou kvůli vysokému zatížení nebo údržbě.ServiceUnavailable indicates that the server is temporarily unavailable, usually due to high load or maintenance. |
| SwitchingProtocols | 101 | Odpovídá stavu HTTP 101.Equivalent to HTTP status 101. SwitchingProtocolsindikuje, že se mění verze protokolu nebo protokol.SwitchingProtocols indicates that the protocol version or protocol is being changed. |
| TemporaryRedirect | 307 | Odpovídá stavu HTTP 307.Equivalent to HTTP status 307. TemporaryRedirectoznačuje, že informace o žádosti se nacházejí v identifikátoru URI zadaném v hlavičce umístění.TemporaryRedirect indicates that the request information is located at the URI specified in the Location header. Výchozí akce, pokud je tento stav přijat, je postupovat podle hlavičky umístění přidružené k odpovědi.The default action when this status is received is to follow the Location header associated with the response. Pokud byla metoda původní žádosti POST, přesměrovaný požadavek použije také metodu POST.When the original request method was POST, the redirected request will also use the POST method. |
| TooManyRequests | 429 | Odpovídá stavu HTTP 429.Equivalent to HTTP status 429. TooManyRequestsindikuje, že uživatel odeslal v daném časovém intervalu příliš mnoho požadavků.TooManyRequests indicates that the user has sent too many requests in a given amount of time. |
| Unauthorized | 401 | Odpovídá stavu HTTP 401.Equivalent to HTTP status 401. Unauthorizedindikuje, že požadovaný prostředek vyžaduje ověření.Unauthorized indicates that the requested resource requires authentication. Hlavička WWW-Authenticate obsahuje podrobné informace o tom, jak provést ověřování.The WWW-Authenticate header contains the details of how to perform the authentication. |
| UnavailableForLegalReasons | 451 | Odpovídá stavu HTTP 451.Equivalent to HTTP status 451. UnavailableForLegalReasonsindikuje, že Server odmítá přístup k prostředku jako důsledek právního požadavku.UnavailableForLegalReasons indicates that the server is denying access to the resource as a consequence of a legal demand. |
| UnprocessableEntity | 422 | Odpovídá stavu HTTP 422.Equivalent to HTTP status 422. UnprocessableEntityoznačuje, že požadavek byl ve správném formátu, ale nemohl být následován z důvodu sémantických chyb.UnprocessableEntity indicates that the request was well-formed but was unable to be followed due to semantic errors. |
| UnsupportedMediaType | 415 | Odpovídá stavu HTTP 415.Equivalent to HTTP status 415. UnsupportedMediaTypeindikuje, že se jedná o nepodporovaný typ.UnsupportedMediaType indicates that the request is an unsupported type. |
| Unused | 306 | Odpovídá stavu HTTP 306.Equivalent to HTTP status 306. Unusedje navržené rozšíření specifikace HTTP/1.1, které není zcela zadáno.Unused is a proposed extension to the HTTP/1.1 specification that is not fully specified. |
| UpgradeRequired | 426 | Odpovídá stavu HTTP 426.Equivalent to HTTP status 426. UpgradeRequiredindikuje, že klient by měl přepnout na jiný protokol, jako je TLS/1.0.UpgradeRequired indicates that the client should switch to a different protocol such as TLS/1.0. |
| UseProxy | 305 | Odpovídá stavu HTTP 305.Equivalent to HTTP status 305. UseProxyoznačuje, že žádost by měla používat proxy server v identifikátoru URI zadaném v hlavičce umístění.UseProxy indicates that the request should use the proxy server at the URI specified in the Location header. |
| VariantAlsoNegotiates | 506 | Odpovídá stavu HTTP 506.Equivalent to HTTP status 506. VariantAlsoNegotiatesoznačuje, že zvolený variantní prostředek je nakonfigurován tak, aby se mohl zapojit do transparentního vyjednávání obsahu, a proto není správným koncovým bodem v procesu vyjednávání.VariantAlsoNegotiates indicates that the chosen variant resource is configured to engage in transparent content negotiation itself and, therefore, isn't a proper endpoint in the negotiation process. |
Příklady
Následující příklad porovnává stav vrácený HttpWebResponse s členem HttpStatusCode třídy za účelem určení stavu odpovědi.The following example compares the status returned by an HttpWebResponse with a member of the HttpStatusCode class to determine the status of a response.
HttpWebRequest^ httpReq = dynamic_cast<HttpWebRequest^>(WebRequest::Create( "http://www.contoso.com" ));
httpReq->AllowAutoRedirect = false;
HttpWebResponse^ httpRes = dynamic_cast<HttpWebResponse^>(httpReq->GetResponse());
if ( httpRes->StatusCode == HttpStatusCode::Moved )
{
// Code for moved resources goes here.
}
// Close the response.
httpRes->Close();
HttpWebRequest httpReq = (HttpWebRequest)WebRequest.Create("http://www.contoso.com");
httpReq.AllowAutoRedirect = false;
HttpWebResponse httpRes = (HttpWebResponse)httpReq.GetResponse();
if (httpRes.StatusCode==HttpStatusCode.Moved)
{
// Code for moved resources goes here.
}
// Close the response.
httpRes.Close();
Dim httpReq As HttpWebRequest = CType(WebRequest.Create("http://www.contoso.com"), HttpWebRequest)
httpReq.AllowAutoRedirect = False
Dim httpRes As HttpWebResponse = CType(httpReq.GetResponse(), HttpWebResponse)
If httpRes.StatusCode = HttpStatusCode.Moved Then
' Code for moved resources goes here.
End If
httpRes.Close()
Poznámky
HttpStatusCodeVýčet obsahuje hodnoty stavových kódů definovaných v dokumentu RFC 2616 pro protokol HTTP 1,1.The HttpStatusCode enumeration contains the values of the status codes defined in RFC 2616 for HTTP 1.1.
Stav požadavku HTTP je obsažen ve HttpWebResponse.StatusCode Vlastnosti.The status of an HTTP request is contained in the HttpWebResponse.StatusCode property.
Pokud HttpWebRequest.AllowAutoRedirect je vlastnost false , následující hodnoty výčtu způsobí vyvolání výjimky:If the HttpWebRequest.AllowAutoRedirect property is false, the following enumeration values cause an exception to be thrown:
AmbiguousFoundMultipleChoicesRedirectRedirectKeepVerbRedirectMethodSeeOtherTemporaryRedirect