public void UrlReferrerCheck(string refferUrl) { if (Request.UrlReferrer == null) { string script = "< script>alert('직접 접근할 수 없습니다!!');" +"location.href='/Default.aspx'; "; Page.RegisterClientScriptBlock(" done ", script); //Response.Redirect(refferUrl); } else { string refer = Request.UrlReferrer.ToString(); string ServerPath = Request.Url.ToString(); ServerPath = ServerPath.Substring(0, ServerPath.LastIndexOf(" / ")); if (refer.IndexOf(ServerPath) == -1) { string script = " < script> alert('직접 접근할 수 없습니다!!'); " + " location.href = '/Default.aspx'; "; Page.RegisterClientScriptBlock(" done ", script); //Response.Redirect(refferUrl); } } }
2003/10/24
Referrer값 체크로 특정파일에 직접 접근 거부
레퍼러값을 체크하는 방법 2가지 입니다. 먼저, 레퍼러값이 null 값일경우 Default.aspx 페이지로 리다이렉팅. 만일 레퍼러값이 있을경우 현재, 사이트의 도메인과 레퍼러주소의 도메인이 다를경우 다시 Redirect 를 합니다. 바로 Redirect 를 해도 되지만, 자바스크립트로 Alert 를 띄운후 처리..
가장 많이 본 글
-
서버가 다음 오류 때문에 '\\10.0.1.100\WWW_ROOT' 디렉터리에 대한 '/ftp' 가상 루트를 추가하지 못했습니다(네트워크 BIOS 명령 한계에 도달했습니다. ). 데이터는 오류 코드입니다.
-
#50070: server\SharePoint의 STC_Config 데이터베이스에 연결할 수 없습니다. 데이터베이스 연결 정보를 확인하고 데이터베이스 서버가 실행 중인지 확인하십시오.
-
Drive Array Physical Drive Status Change. The physical drive in Slot 0, Port 1I Box 1 Bay 2 with serial number "9SF1CWZ9 ...
댓글 없음:
댓글 쓰기