Global.asax
및 Application_BeginRequest
에서 요청 된 경로를 얻으려면 분할하고, 만료되었는지 확인하고, 문자열을 조작하고 그 에테르 오류 페이지에 에테르 실제 경로로 다시 작성 :
protected void Application_BeginRequest(Object sender, EventArgs e)
{
string cTheFile = HttpContext.Current.Request.Path;
if (cTheFile.EndsWith("/file.mp4", StringComparison.InvariantCultureIgnoreCase))
{
// manipulate your string to see if is expired...
string[] keys = HttpContext.Current.Request.Path.Split('/');
// get the 34567fghft part
if (IfExpired(keys[keys.Length - 1]))
{
HttpContext.Current.Response.Redirect("ExpiredMessage.aspx", true);
return ;
}
else
{
HttpContext.Current.RewritePath("http://localhost/video/file.mp4", false);
}
}
}
이 코드는 어떻게하는지에 대한 아이디어입니다. 더 나은 문자열 조작과 오류 검사가 필요합니다.
감사합니다.이 방법을 사용해 보았지만 나에게 도움이되지 않습니다. 정적 파일 요청은 Application_BeginRequest를 통과하지 못하므로 mp4 요청을 처리 할 수 없습니다. 나는 클래스를 써서 IHttpHandler를 상속 받아 mp4 요청을 받고 RewritePath를 실제 URL로 가져 왔지만 Player는 재생할 수 없습니다. -s – DzungHoang
@dugchie Ether이 파일을 제공하는 핸들러를 작성하거나 IIS를 설정하면이 정적 파일이 다음과 같이 전달됩니다. asp.net – Aristos