HttpRequest.QueryString 속성

정의

HTTP 쿼리 문자열 변수의 컬렉션을 가져옵니다.

public:
 property System::Collections::Specialized::NameValueCollection ^ QueryString { System::Collections::Specialized::NameValueCollection ^ get(); };
public System.Collections.Specialized.NameValueCollection QueryString { get; }
member this.QueryString : System.Collections.Specialized.NameValueCollection
Public ReadOnly Property QueryString As NameValueCollection

속성 값

NameValueCollection

클라이언트에서 보낸 쿼리 문자열 변수입니다. 키와 값은 URL로 디코딩됩니다.

예제

다음 코드 예제에서는 "fullname"이라는 쿼리 문자열 변수의 값을 가져오는 두 가지 방법을 보여줍니다. 각 경우에 URL이 있으면 반환되는 http://www.contoso.com/default.aspx?fullname=Fadi%20Fakhouri값은 URL이 공백 문자로 디코딩되기 때문에 %20 "Fadi Fakhouri"입니다. URL에 쿼리 문자열 ID가 fullname 없으면 반환된 값이 됩니다 null.

코드의 첫 번째 줄은 쿼리 문자열에서만 "fullname" 키를 찾습니다. 두 번째 줄은 모든 HTTP 요청 컬렉션에서 "fullname" 키를 찾습니다. 두 번째 줄에 대한 자세한 내용은 다음을 참조하세요 Item[].

string fullname1 = Request.QueryString["fullname"];
string fullname2 = Request["fullname"];
Dim fullname1 As String = Request.QueryString("fullname")
Dim fullname2 As String = Request("fullname")

적용 대상

추가 정보