c# - Application_PreRequestHandlerExecute redirect during 404 page not found -
i trying log referrers several domains own 301 permanent redirect our secure site. have 2 web sites via iis.
http://www.cool_domain.com/ redirect https://www.real_domain.com/ example. during process, want log, , redirect during prerequesthandlerexecute method.
if page not found (404), application_prerequesthandlerexecute not fire. if exist, fires fine.
void application_prerequesthandlerexecute(object sender, eventargs e) { if (context.handler irequiressessionstate || context.handler ireadonlysessionstate) { logpage(request); httpcontext.current.response.redirectpermanent("https://www.real_domain.com/", true); } }
how can fire during 404's well?
stupid mistake, , should have known... in case else runs this, , has brainfart well, global.asax not execute 404 error unless it's .net page (aspx, etc.).
Comments
Post a Comment