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 를 띄운후 처리..
가장 많이 본 글
-
안녕하세요.^^ 1. 메일 질문 종종 메일( webmaster@serverinfo.pe.kr )로 저에게 질문을 던져 주시는 분들이 계시는데요,. 제 홈페이지에도 써놓았지만,. 메일을 통한 서버관련 질문에 대해서는 절대 답변을 드리지 않습니다.!! 아...
-
처리되지 않은 예외: System.Security.Authentication.AuthenticationException: SSPI를 호출하지 못했습니다. 내부 예외를 참조하십시오. ---> System.ComponentModel.Win32Exce...
-
# 프로세스별 스레드/핸들수 확인 (비정상적으로 많은 경우) # C:\Program Files\Support Tools>poolmon.exe -b (Windows 2003 Support Tool 필요) https://www.micr...
댓글 없음:
댓글 쓰기