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

Error upload on server

1 Answer 92 Views
Upload
This is a migrated thread and some comments may be shown as answers.
Tarkan Haser
Top achievements
Rank 1
Tarkan Haser asked on 19 Nov 2009, 08:45 PM

 Hi,

I've done an application that has a radUpload control. If I try the control in my local machine I'm able to upload, save and open the files. But when I publish the application I try to upload a file and I get the 0% uploading state and the file never gets uploaded.

Unhandled Error in Silverlight Application The given key was not present in the dictionary.   at System.ThrowHelper.ThrowKeyNotFoundException()
   at System.Collections.Generic.Dictionary`2.get_Item(TKey key)
   at Telerik.Windows.Controls.FileUploader.OnResponse(IAsyncResult asyncResult)
   at System.Net.Browser.BrowserHttpWebRequest.<>c__DisplayClassd.<InvokeGetResponseCallback>b__b(Object state2)
   at System.Threading._ThreadPoolWaitCallback.WaitCallback_Context(Object state)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Threading._ThreadPoolWaitCallback.PerformWaitCallbackInternal(_ThreadPoolWaitCallback tpWaitCallBack)
   at System.Threading._ThreadPoolWaitCallback.PerformWaitCallback(Object state)

I try to upload allready exists file i give an error message that access denied.
.xaml file:

<telerikInput:RadUpload   
    x:Name="RadUploadLogo"   
    Margin="0,173,8,0"   
    HorizontalAlignment="Right"   
    Width="310"   
    Filter="Resim Dosyaları (*.jpg;*.jpeg;*.png)|*.jpg;*.jpeg;*.png|Tüm Dosyalar (*.*)|*.*;" 
    IsMultiselect="False"   
    FilterIndex="0"   
    OverwriteExistingFiles="True"   
    UploadServiceUrl="~/MyUploadHandler.ashx"   
    TargetFolder="Images/MusteriLogolari" 
    VerticalAlignment="Top" Height="170" Background="#35000000" BorderBrush="White"/>  
 
 

c# code :
void RadUploadLogo_FileUploadStarting(object sender, FileUploadStartingEventArgs e)  
        {  
            //e.FileParameters.Add("Authorized", "True");  
            string fileName = App.appKullaniciTanimi.cKodHesap;  
            int i = e.UploadData.FileName.LastIndexOf('.');  
            if (i >= 0 && i < e.UploadData.FileName.Length)  
            {  
                fileName += e.UploadData.FileName.Substring(i);  
            }  
            GonderilenDosya = fileName;  
            e.UploadData.FileName = fileName;  
        }  
 

MyUploadHandler.ashx :
using System;  
using System.Web;  
using Telerik.Windows.Controls;  
 
namespace QuipusBilisimB2B.Web  
{  
    public class MyUploadHandler : Telerik.Windows.RadUploadHandler  
    {  
        public override void ProcessStream()  
        {  
            string authorized = this.Request.Form["Authorized"];  
            bool isOK = !string.IsNullOrEmpty(authorized) && authorized.ToLower() == "true";  
            //if (!isOK)  
            //{  
            //    ////this.CancelRequest();  
            //    ////this.Result.Add("Error", "Security token is required.  Please login.");  
            //    ////this.AddReturnParam("Error", "Security token is required.  Please login.");  
            //    this.AddReturnParam(RadUploadConstants.ParamNameMessage, "Security token is required. Please login.");  
 
            //    string fileName = this.Request.Form[RadUploadConstants.ParamNameFileName];  
            //    string filePath = this.GetFilePath(fileName);  
 
            //    this.AddReturnParam(RadUploadConstants.ParamNameSuccess, false);  
            //    this.AddReturnParam(RadUploadConstants.ParamNameFileIdent, filePath);  
            //    this.AddReturnParam(RadUploadConstants.ParamNameFileName, fileName);  
            //    this.AddReturnParam(RadUploadConstants.ParamNameFilePath, filePath);  
            //    this.AddReturnParam(RadUploadConstants.ParamNameFinalFileRequest, true);  
 
            //    return;  
            //}  
 
            base.ProcessStream();  
        }  
    }  
}  
 

1 Answer, 1 is accepted

Sort by
0
Ivan
Telerik team
answered on 20 Nov 2009, 11:20 PM
Hi Tarkan,

Thank you for contacting us.

Could you please follow instructions in the Troubleshooting RadUpload for Silverlight article.

Of course if the issue persists please contact us again.

Greetings,
Ivan
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Tags
Upload
Asked by
Tarkan Haser
Top achievements
Rank 1
Answers by
Ivan
Telerik team
Share this question
or