로그인 페이지에서 SSL 페이지로 post 방식으로 전송 시 SSL 페이지에서 인증 처리를 하게 된다..NET에서 이 SSL 페이지에서 인증 처리 후 Response.Redirect 로 원래의 페이지로 보내버리게 되면보안경고가 발생하는 클라이언트가 있다. 정확한 원인은 아직 확인하지 못했지만 서비스팩3 을 설치하거나 OS 2003, 비스타일 경우 또는 IE6버전에서 발생하는 듯 보인다.한국정보보호 진흥원(KISA)에서는 인증 처리 후 Response.Redirect 로 리디렉션 시 보안 경고가 발생할 수 있다고 한다.Response.Redirect 대신 head 태그 에 아래의 메타 태그를 넣어주면 보안 경고가 발생하지 않는다.<meta http-equiv="REFRESH" content="0; url='<%=url%>'" />위 태그는 페이지 처리 후 url 주소로 리프레쉬 해주는 역할을 한다.실제로 이렇게 변경 한 후 테스트 해보니 보안 경고가 발생하지 않는다.여기서 궁금한 점은.. Response.Redirect 내부에서 어떤 처리를 하기에.. 보안경고가 발생하는 것일까 하는 것이다..추측에 https가 아닌 http로 통신하는 뭔가가 있는지 궁금하여 Response.Redirect 메소드의 소스를 까 봤다..
public void Redirect(string url, bool endResponse){ if (url == null) { throw new ArgumentNullException("url"); } if (url.IndexOf('\n') >= 0) { throw new ArgumentException(SR.GetString("Cannot_redirect_to_newline")); } if (this._headersWritten) { throw new HttpException(SR.GetString("Cannot_redirect_after_headers_sent")); } Page handler = this._context.Handler as Page; if ((handler != null) && handler.IsCallback) { throw new ApplicationException(SR.GetString("Redirect_not_allowed_in_callback")); } url = this.ApplyRedirectQueryStringIfRequired(url); url = this.ApplyAppPathModifier(url); url = this.ConvertToFullyQualifiedRedirectUrlIfRequired(url); url = this.UrlEncodeRedirect(url); this.Clear(); if (((handler != null) && handler.IsPostBack) && (handler.SmartNavigation && (this.Request["__smartNavPostBack"] == "true"))) { this.Write("<BODY><ASP_SMARTNAV_RDIR url=\""); this.Write(HttpUtility.HtmlEncode(url)); this.Write("\"></ASP_SMARTNAV_RDIR>"); this.Write("</BODY>"); } else { this.StatusCode = 0x12e; this.RedirectLocation = url; this.Write("<html><head><title>Object moved</title></head><body>\r\n"); this.Write("<h2>Object moved to <a href=\"" + HttpUtility.HtmlAttributeEncode(url) + "\">here</a>.</h2>\r\n"); this.Write("</body></html>\r\n"); } this._isRequestBeingRedirected = true; if (endResponse) { this.End(); }}
위 빨간색 글씨의 코드를 타는 듯 보이지만 왜 보안경고가 뜨는지는 확인하기 힘들다. KISA에서도 Response.Redirect를 사용하지 마라는 구체적인 이유에 대해서는 언급하지 않아 확인할 길이 없어 보인다. 혹시라도 아시는 분이 있다면 코멘트를 달아주시면 감사드리겠습니다.^^