일반적으로 응답 쿠키 :
응답 쿠키 컬렉션으로 시작하겠습니다. 나는 그것이 더 쉬울 수 있다고 생각하지 않습니다. 당신은 단순히 쿠키의 이름을 논쟁에 넣습니다. 해당 값은 문자열입니다. 복잡해지는 유일한 시간은 키를 사용할 때입니다 (아래에서 보여줍니다).
<%@language = "javaScript"%> <%var tomorrow = new Date () Tomorrow.SetDate.SetDate (Tomorrow.GetDate () + 1) MyExpire = (내일 .getMonth () + 1) + "/" + Tomorrow.getDate () MyExpire + = "/" + 내일 () response.cookies ( "FirstCookie") = 쿠키. "response.cookies ("FirstCookie "). 만료 = MyExpirerEsponse.cookies ("SecondCookie ") ="ASP 쿠키는 쉽습니다. "response.cookies ("SecondCookie "). Expires = MyExpirerEsponse.cookies ("ThirdCookie ") ("FirstKey ") ="여기에 첫 번째입니다 key. "response.cookies ("ThirdCookie ") ("SecondKey ") ="여기에는 두 번째 키가 있습니다. "response.cookies ("ThirdCookie "). 만료 = myExpire%> <html> 우리는 단지 <%= response.cookies.count chipies를 설정합니다. <br> <a href ="script09a.asp "> here </a> to to thistreve 쿠키. </html>새 창에서 스크립트를 실행하려면 여기를 클릭하십시오.
ASP로 쿠키를 설정하는 것은 매우 간단합니다. 형식은입니다
응답 쿠키 키 :
ASP 응용 프로그램 응답의 첫 번째 페이지에서 Cookies ( "MyonlyCookie")가 설정된 경우 응용 프로그램 응답 2 페이지에서 Cookies ( "MyonlyCookie")가 두 번째 값을 재 할당하면 두 번째 값 만 남아 있습니다. 이 상황에서 첫 번째 값이 손실됩니다.
해결책은 여러 쿠키를 사용하거나 동일한 쿠키에서 여러 키를 사용하는 것입니다.
response.cookies ( "ThirdCookie") ( "FirstKey") = "여기서 첫 번째 키는 다음과 같습니다."response.cookies ( "ThirdCookie") ( "SecondKey") = "두 번째 키가 있습니다."
하나 이상의 키 설정은 매우 간단합니다. 이 형식을 따릅니다.
쿠키 요청 :
일반적으로 ASP 쿠키 관리는 클라이언트 측 JavaScript 쿠키보다 훨씬 쉽습니다. 아래는 쿠키를 검색하는 스크립트입니다.
<%@language = "javaScript"%> <%if (response.cookies.count <= 0) {response.redirect ( "script09.asp")} var firstCookie = request.Cookies ( "FirstCookie"); var SecondCookie = request.Cookies ( "SecondCookie"); var ThirdCookie2Keys = request.Cookies ( "ThirdKookie") ( "FirstKey") ( "FirstKey") ( "FirstKey") ( "FirstKey") ( "FirstKey") ( "The ThirdCookie") ( "SeconKKey");%> <Html> <ball = request.cookies.count%> 쿠키가 있습니다. <%= FirstCookie%> <br> 2) <%= SecondCookie%> <br> 3) <%= ThirdCookie2keys%> <br> <a href = "script09b.asp"> 여기를 클릭하려면 쿠키를 어떻게 정렬 할 것인지 알지 못했습니다. </html>