This repository has been archived by the owner on Nov 9, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
Custom controller response
Alexanderius edited this page Sep 20, 2014
·
2 revisions
You can create your custom controller response by deriving from ControllerResponse
base class and implementing Process
method.
public class MyControllerResponse : ControllerResponse
{
public override ControllerResponseResult Process()
{
// Do your response action
return ControllerResponseResult.Default;
}
}
If your controller will return this controller response then Process
method will be called by framework after controller execution, or on async controllers responses execution if your controller was an async controller.
-
Base controller response class have properties like controller do to access AcspNet modules like
DataCollector
orAcspNetContext
, you can use them to do your actions; -
Additional module available to controller response is
ResponseWriter
, this module provides writing to response; -
Process
method should return one ofControllerResponseResult
enum types:
-
Default
- default result, framework will process other controllers and generate a page; -
RawOutput
- indicates what subsequent controllers execution and page generation should be stopped (for example, if you are providing some custom output to client), no output data will be sent to client except your custom writing to response; -
Redirect
- indicates what controller response doing some client redirection, technically same asRawOutput
.
- Getting Started
- Main AcspNet principles
- AcspNet controllers
- Controllers basics
- Controllers attributes
- Controllers routing
- Controllers responses
- Controllers properties
- Controllers model binding
- AcspNet views
- AcspNet templates
- Template factory
- Data collector
- String table
- File reader
- AcspNet context
- Environment
- Language manager
- Redirector
- HTML