0
내 웹 사이트에 대한 사용자 지정 HttpHandler를 구현하여 페이지가 목록에 있으면 해당 페이지를 특정 페이지로 리디렉션합니다. 지금까지는 리디렉션이 정상적으로 작동하지만 최종 페이지의 내용이 공백으로 표시됩니다. 내 PageHandler에서HttpHandler 구현
코드 : 내 Web.Config 파일에서
public class CustomPageHandler : IHttpHandler
{
public bool IsReusable
{
get { return false; }
}
public void ProcessRequest(HttpContext context)
{
List<string> fileList = new List<string>();
fileList.Add("Page1.aspx");
fileList.Add("Page2.aspx");
foreach (string fileName in fileList)
{
if (context.Request.RawUrl.ToLower().Contains(fileName.ToLower()))
{
context.Response.Redirect("BlockedPage.aspx");
}
}
}
}
코드 [관련 HttpHandler를]
<httpHandlers>
.
.
.
<add verb="*" path="*.aspx" type="CustomPageHandler, App_Code"/>
</httpHandlers>
사람이 끈적 상황에서 얻을하는 데 도움이 수 있습니까? 미리 감사드립니다 ...
그 핸들러는 ashx입니까? –
@AntonioBakula 아니, .ashx .cs 파일을 사용할 수 없습니다. – mahfuz01