This is a migrated thread and some comments may be shown as answers.

RadUpload does not show the progress bar.

1 Answer 151 Views
Upload (Obsolete)
This is a migrated thread and some comments may be shown as answers.
Amitabh
Top achievements
Rank 1
Amitabh asked on 23 Mar 2011, 07:53 PM
I am using the RadUpload control along with the Rad Progress bar. This was working fine for more than year. Recently we had to add another HttpModule to track the Url in our website. Since then the Rad Progress bar does not show at all. I even downloaded the latest Telerik demo project and added  a simple TestModule. This also breaks the Rad Progress bar.   

using System;
using System.Collections.Generic;
using System.Text;
using System.Web;
using System.Configuration;
 
namespace HttpModules
{
    public class TestModule : IHttpModule
    {
        protected log4net.ILog logger = log4net.LogManager.GetLogger("File");
 
        public void Init(HttpApplication app)
        {
            app.BeginRequest += new EventHandler(OnBeginRequest);
        }
 
        public void OnBeginRequest(Object sender, EventArgs e)
        {
            try
            {
                logger.InfoFormat("TestModule => OnBeginRequest");
 
                HttpApplication app = (HttpApplication)sender;
                HttpContext context = app.Context;
 
                logger.InfoFormat("TestModule => This is just a Test module");
 
                if (IsTelerikRequest(context.Request))
                    return;
 
                string source = context.Request["source"];
 
                if (!string.IsNullOrEmpty(source))
                {
                    logger.InfoFormat("TestModule => source is {0} ", source);
                }
 
            }
            catch(Exception ex)
            {
                logger.Error("Error in Test Module", ex);
            }
        }
 
        private bool IsTelerikRequest(HttpRequest httpRequest)
        {
            logger.InfoFormat("TestModule => IsTelerikRequest (httpRequest.RawUrl : '{0}')", httpRequest.RawUrl);
            return httpRequest.RawUrl.Contains("RadUploadProgressHandler.ashx");
        }
 
        private static bool IsAjaxRequest(HttpRequest request)
        { 
            if (request == null) 
            {
                throw new ArgumentNullException("request");
            } 
            
            return (request["X-Requested-With"] == "XMLHttpRequest") || ((request.Headers != null) && (request.Headers["X-Requested-With"] == "XMLHttpRequest")); 
        }
 
        public void Dispose() 
        {
 
        }
    }
}

1 Answer, 1 is accepted

Sort by
0
Dimitar Terziev
Telerik team
answered on 29 Mar 2011, 03:55 PM
Hello Amitabh,

Your problem seems to be related to the fact that calling " context.Request["source"] " parses (uploads) everything which in turn leaves RadUpload with an empty request. Hence no progress is displayed. There are two possible workarounds:
  1. Don't use Request.Params in your code. Use Request.QueryString instead. It does not force the upload.
  2. Put your logic in some event which occurs after RadUpload's progress handling - for example PostRequestHandlerExecute (which is where RadUpload stops processing the request) or EndRequest (which is fired at the end of each request).

Best wishes,
Dimitar Terziev
the Telerik team
Tags
Upload (Obsolete)
Asked by
Amitabh
Top achievements
Rank 1
Answers by
Dimitar Terziev
Telerik team
Share this question
or