Example #1
0
        public async Task <bool> Handle(IDotvvmRequestContext cx)
        {
            if (DotvvmMiddlewareBase.GetCleanRequestUrl(cx.HttpContext) == HostingConstants.CsrfTokenMatchUrl)
            {
                var token = csrfProtector.GenerateToken(cx);
                await cx.HttpContext.Response.WriteAsync(token);

                return(true);
            }
            return(false);
        }
Example #2
0
        public async Task <bool> Handle(IDotvvmRequestContext request)
        {
            var url = DotvvmMiddlewareBase.GetCleanRequestUrl(request.HttpContext);

            if (url.StartsWith("dotvvmReturnedFile", StringComparison.Ordinal))
            {
                await RenderReturnedFile(request.HttpContext, request.Configuration.ServiceLocator.GetService <IReturnedFileStorage>());

                return(true);
            }
            else
            {
                return(false);
            }
        }
Example #3
0
        public async Task <bool> Handle(IDotvvmRequestContext request)
        {
            var url = DotvvmMiddlewareBase.GetCleanRequestUrl(request.HttpContext);

            // file upload handler
            if (url == HostingConstants.FileUploadHandlerMatchUrl ||
                url.StartsWith(HostingConstants.FileUploadHandlerMatchUrl + "?", StringComparison.OrdinalIgnoreCase))
            {
                await ProcessMultipartRequest(request.HttpContext);

                return(true);
            }

            return(false);
        }
        public async Task <bool> Handle(IDotvvmRequestContext request)
        {
            var url = DotvvmMiddlewareBase.GetCleanRequestUrl(request.HttpContext);

            if (url.StartsWith(HostingConstants.GlobalizeCultureUrlPath, StringComparison.Ordinal))
            {
                await RenderResponse(request.HttpContext);

                return(true);
            }
            else
            {
                return(false);
            }
        }
        public async Task <bool> Handle(IDotvvmRequestContext request)
        {
            var url = DotvvmMiddlewareBase.GetCleanRequestUrl(request.HttpContext);

            // embedded resource handler URL
            if (url.StartsWith(HostingConstants.ResourceHandlerMatchUrl, StringComparison.Ordinal))
            {
                await RenderEmbeddedResource(request.HttpContext);

                return(true);
            }
            else
            {
                return(false);
            }
        }