asp.net - Passing Error from HttpModule to MVC Application -
i have custom httpmodule authentication. in authenticaterequest event handler of module check if custom sso ticket available , in case perform authentication logic.
if sso ticket available, incorrect, show friendly error message user. prefer able somehow set http status 401 (unauthorized, used when authentication fails) , pass on meaningful error message http module.
i mvc application somehow information , use render custom 401 error page includes meaningful error message module.
what's best way raise error in http module , what's best way have display error using mvc application (to error message in mvc application's layout)?
you create custom controllerfactory, , in your:
protected override icontroller getcontrollerinstance(requestcontext context, type controllertype)
you have access httpcontext , routedata through context object. if user not authenticated can manipulate routedata targed desired controller/action desired routeconstraints/parameters (for instance http status message)
Comments
Post a Comment