Я использовал интерфейс IhttpHandler для обработки возврата моего изображения.
IHttpHandlerFactory - это то, что я использую для обработки перехвата страницы:
public class HttpCMSHandlerFactory : IHttpHandlerFactory
{
// collects page name requested
string pageName = Path.GetFileNameWithoutExtension(context.Request.PhysicalPath);
// Add the page name to the context
context.Items.Add("PageName", pageName);
// I can still check if the page physically exists else pass on to my CMS handler: CMSPage.aspx
FileInfo fi = new FileInfo(context.Request.MapPath(context.Request.CurrentExecutionFilePath));
if (fi.Exists == false)
{
// if page doesnt exist context info is passed on to CMSPage to handle copy
return PageParser.GetCompiledPageInstance(string.Concat(context.Request.ApplicationPath, "/CMSPage.aspx"), url, context);
}
else
{
// if page exist physical page is returned
return PageParser.GetCompiledPageInstance(context.Request.CurrentExecutionFilePath, fi.FullName, context);
}
}
проверить мой предыдущий пост на эту тему