Telerik.Web.Mvc.WebAssetHttpHandler.ProcessRequest C# (CSharp) Method

ProcessRequest() public method

Enables a WebAssetHttpHandler object to process of requests.
public ProcessRequest ( System.Web.HttpContextBase context ) : void
context System.Web.HttpContextBase The context.
return void
        public override void ProcessRequest(HttpContextBase context)
        {
            string id = context.Request.QueryString[IdParameterName];

            if (!string.IsNullOrEmpty(id))
            {
                WebAsset asset = assetRegistry.Retrieve(id);

                if (asset != null)
                {
                    HttpResponseBase response = context.Response;

                    // Set the content type
                    response.ContentType = asset.ContentType;

                    string content = asset.Content;

                    if (!string.IsNullOrEmpty(content))
                    {
                        // Compress
                        if (asset.Compress && !context.IsMono())
                        {
                            httpResponseCompressor.Compress(context);
                        }

                        // Write
                        using (StreamWriter sw = new StreamWriter((response.OutputStream)))
                        {
                            sw.Write(content);
                        }

                        // Cache
                        if (!context.IsDebuggingEnabled)
                        {
                            httpResponseCacher.Cache(context, TimeSpan.FromDays(asset.CacheDurationInDays));
                        }
                    }
                }
            }
        }