This question is locked. New answers and comments are not allowed.
Hello Readers.I'm starting a new thread here, since I could not find an answer to my problem anywhere else.
Typically me scenrio is that I want to use the RadUpload and the RandUploadHandler in SharePoint but in a Sandbox solution.
So, although you can create modules, you can't create and use the layouts folder.
Can someone help me with can example of where the uploadhandler.ashx should be, where should the codebehind Uploadhandler.cs go, and what is the correct URL sytanx to use for the UploadServiceURL property?
Any help or guideance on this will be appreciated.
Thank you.
Typically me scenrio is that I want to use the RadUpload and the RandUploadHandler in SharePoint but in a Sandbox solution.
So, although you can create modules, you can't create and use the layouts folder.
Can someone help me with can example of where the uploadhandler.ashx should be, where should the codebehind Uploadhandler.cs go, and what is the correct URL sytanx to use for the UploadServiceURL property?
Any help or guideance on this will be appreciated.
Thank you.
8 Answers, 1 is accepted
0
Pinaki
Top achievements
Rank 1
answered on 01 Mar 2012, 10:44 AM
Anyone? Telerik?
Question is simple. Is is possible to implement your RadUplaod example (aslo seen the video) in a sandbox solution. My question is where to put the uploadhandler ashx and code?
Question is simple. Is is possible to implement your RadUplaod example (aslo seen the video) in a sandbox solution. My question is where to put the uploadhandler ashx and code?
0
Hi Pinaki,
Please accept our apology for the delayed response.
In a SharePoint solution there are many restrictions which you'll need to work around in order to upload files using the RadUpload control.
Firstly, you'll need to upload the RadUploadHanler somewhere on your server where the RadUpload can access it. However, by default in SharePoint the .ashx files are blocked and you'll need to change that by removing this type of files from the blocked file types list. This will allow you to upload the UploadHandler in a library in SharePoint or add it in a Module in the SharePoint solution.
But the UploadHandler.ashx file needs a code-behind file and you'll need to make sure that the Telerik.Windows.RadUploadHandler.dll can be accessed and found by the server. For example you can add the following UploadHandler in the SilverlightXAP module (from the video tutorial)
And make sure that the Telerik.Windows.RadUploadHandler.dll is included into the SharePoint project Package.
When you add the SampleUploadHandler to the SilverlightXAP module, you can access it under the following path: /SilverlightXAP/SampleUploadHandler.ashx, and this should be the value of the RadUpload.UploadServiceUrl property.
Also you need to keep in mind that the RadUpload control logic needs access to its TargetFolder in order to save the selected files.
Basically when you create a Sandbox solution which takes advantage of the RadUpload control, you need to carefully plan your server configuration, the Sandbox solution permissions and deployment strategy so that the client-side can access the UploadHandler file as well as the directory where the files will be stored.
All the best,
Tina Stancheva
the Telerik team
Please accept our apology for the delayed response.
In a SharePoint solution there are many restrictions which you'll need to work around in order to upload files using the RadUpload control.
Firstly, you'll need to upload the RadUploadHanler somewhere on your server where the RadUpload can access it. However, by default in SharePoint the .ashx files are blocked and you'll need to change that by removing this type of files from the blocked file types list. This will allow you to upload the UploadHandler in a library in SharePoint or add it in a Module in the SharePoint solution.
But the UploadHandler.ashx file needs a code-behind file and you'll need to make sure that the Telerik.Windows.RadUploadHandler.dll can be accessed and found by the server. For example you can add the following UploadHandler in the SilverlightXAP module (from the video tutorial)
<%@ WebHandler Language="C#" Class="UploadProject.UploadHandler" %>
<%@ Assembly Name="Telerik.Windows.RadUploadHandler" %>
using Telerik.Windows;
using System.IO;
namespace UploadProject
{
public class UploadHandler : RadUploadHandler
{
}
}
When you add the SampleUploadHandler to the SilverlightXAP module, you can access it under the following path: /SilverlightXAP/SampleUploadHandler.ashx, and this should be the value of the RadUpload.UploadServiceUrl property.
Also you need to keep in mind that the RadUpload control logic needs access to its TargetFolder in order to save the selected files.
Basically when you create a Sandbox solution which takes advantage of the RadUpload control, you need to carefully plan your server configuration, the Sandbox solution permissions and deployment strategy so that the client-side can access the UploadHandler file as well as the directory where the files will be stored.
All the best,
Tina Stancheva
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
0
Pinaki
Top achievements
Rank 1
answered on 04 Mar 2012, 01:58 PM
Hi Tina.
Thank you for your tips, but it still does not help.
Let me explain what's going on.
Unlike other examples given, mine needs to be a sandbox solution, and so can't use _layouts. So, I've done exactly as you had mentioned above. My .ashx file now has code inside it, (not a code behind). My uploadhandler ashx file (a single file now) looks like this.
But the problem is, at runtime, it can't find the Telerik.Windows.RadUploadHandler DLL even though it is included in my package, to be deployed.
My manifest has the dll included, and I still get the error. See attached screenshot.
I've spent too much time on it, and really need some help here. Can Telerik help?
Thank you.
Thank you for your tips, but it still does not help.
Let me explain what's going on.
Unlike other examples given, mine needs to be a sandbox solution, and so can't use _layouts. So, I've done exactly as you had mentioned above. My .ashx file now has code inside it, (not a code behind). My uploadhandler ashx file (a single file now) looks like this.
<%@ WebHandler Language=
"C#"
Class=
"SandBoxFileUpload.UploadHandler,SandBoxFileUpload, Version=1.0.0.0, Culture=neutral, PublicKeyToken=3ebdc90910e74959"
%>
<%@ Assembly Name=
"Telerik.Windows.RadUploadHandler"
%>
using
System;
using
System.IO;
using
Microsoft.SharePoint;
using
Telerik.Windows;
namespace
SandBoxFileUpload
{
public
class
UploadHandler : RadUploadHandler
{
public
override
bool
SaveChunkData(
string
filePath,
long
position,
byte
[] buffer,
int
contentLength,
out
int
savedBytes)
{
bool
result =
base
.SaveChunkData(filePath, position, buffer, contentLength,
out
savedBytes);
if
(IsFinalFileRequest())
{
SPContext.Current.Web.AllowUnsafeUpdates =
true
;
var fStream =
new
FileStream(filePath, FileMode.Open);
//.....
}
}
}
But the problem is, at runtime, it can't find the Telerik.Windows.RadUploadHandler DLL even though it is included in my package, to be deployed.
My manifest has the dll included, and I still get the error. See attached screenshot.
I've spent too much time on it, and really need some help here. Can Telerik help?
Thank you.
0
Hello Pinaki,
When you add the Assembly tag with the Name property, the handler will be looking for the targeted assembly in the GAC. Basically in this case it doesn't use the assembly from the package but it needs to find it in the GAC, so can you please make sure that the Telerik.Windows.RadUploadHandler.dll is in the GAC?
Let me know how it goes.
Kind regards,
Tina Stancheva
the Telerik team
When you add the Assembly tag with the Name property, the handler will be looking for the targeted assembly in the GAC. Basically in this case it doesn't use the assembly from the package but it needs to find it in the GAC, so can you please make sure that the Telerik.Windows.RadUploadHandler.dll is in the GAC?
Let me know how it goes.
Kind regards,
Tina Stancheva
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
0
Pinaki
Top achievements
Rank 1
answered on 13 Mar 2012, 10:55 PM
Hi Tina. and all at Telerik.
Thank you for your help so far, but I've still not come to a solution. I've implemented all the tips you all have mention here, till the last step.
But my situation is:
This all works fine if the the RadUploadHandler DLL is in the GAC, and the Uploadhandler.ashx file (code in the file, and no .cs file) then it works fine.
But since I need to deploy this in a sandbox solution that is very much closed environment, I cannot access the GAC. So, I need a way to make this work without adding the DLL to the GAC.
I've already included the DLL as a part of the SharePoint package and have added the entry Package Manifest.
My Uploadhandler looks something like this:
Now is there anyway to make the handler work without the DLL in the GAC?.
Can we make a code behind .cs file for this handler using the normal " using..." clause?
The .ashx is inside a module in my solution like SilverlightXAP.
Where should the .cs file be? On the Sharepoint solution root level?
Please help me solve this, Tina.
Your help is appreciated.
Thank you.
Thank you for your help so far, but I've still not come to a solution. I've implemented all the tips you all have mention here, till the last step.
But my situation is:
This all works fine if the the RadUploadHandler DLL is in the GAC, and the Uploadhandler.ashx file (code in the file, and no .cs file) then it works fine.
But since I need to deploy this in a sandbox solution that is very much closed environment, I cannot access the GAC. So, I need a way to make this work without adding the DLL to the GAC.
I've already included the DLL as a part of the SharePoint package and have added the entry Package Manifest.
My Uploadhandler looks something like this:
<%@ Assembly Name=
"Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c"
%>
<%@ Assembly Name=
"Telerik.Windows.RadUploadHandler, Version=2012.1.215.40, Culture=neutral, PublicKeyToken=5803cfa389c90ce7"
%>
<%@ WebHandler Language=
"C#"
Class=
"SandboxFileUpload.UploadHandler"
%>
using
System;
using
Telerik.Windows;
using
Microsoft.SharePoint;
using
System.IO;
namespace
SandboxFileUpload
{
public
class
UploadHandler : RadUploadHandler
{
public
override
bool
SaveChunkData(
string
filePath,
long
position,
byte
[] buffer,
int
contentLength,
out
int
savedBytes)
{
bool
result =
base
.SaveChunkData(filePath, position, buffer, contentLength,
out
savedBytes);
// ....
}
}
}
Now is there anyway to make the handler work without the DLL in the GAC?.
Can we make a code behind .cs file for this handler using the normal " using..." clause?
The .ashx is inside a module in my solution like SilverlightXAP.
Where should the .cs file be? On the Sharepoint solution root level?
Please help me solve this, Tina.
Your help is appreciated.
Thank you.
0
Hi Pinaki,
Unfortunately I am not aware of other approaches other than placing the code-behind code in the ashx file and the Telerik.Windows.UploadHandler assembly in GAC.
Kind regards,
Tina Stancheva
the Telerik team
Unfortunately I am not aware of other approaches other than placing the code-behind code in the ashx file and the Telerik.Windows.UploadHandler assembly in GAC.
Kind regards,
Tina Stancheva
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
0
Pinaki
Top achievements
Rank 1
answered on 01 Jun 2012, 10:35 AM
Hello all at Telerik.
I still have not found a good working solution on this topic.
Basically I need a solution for the UploadHandler.ashx to work without putting any DLL on GAC. Since I'm working in a SandBox solution, I can't access the GAC.
I've already tried the following steps:
- Telerik.Windows.RadUploadHandler.DLL added to manifest, with a <SafeControl>. It did not work.
- compiled the code of the DLL making my own DLL, signed, and added it to the WSP. It did not work.
- Tried with the uploadhandler.ashx with code besides. It did not work.
- Tried it with code behind .CS file. It did not work.
The project only works with you put the DLL in GAC. This is a no-go for Sandbox solutions in SharePoint 2010.
Any help please?
Thank you.
0
Hello Pinaki,
Due to the Sandbox environment limitations, it is very hard to use in the solutions any dynamic controls that rely on external resources. This is why the RadUpload control can't work in a Sandbox solution as its handler should derive from the RadUploadHandler class.
My previous suggestions are the only workaround that we are aware of.
Regards,
Tina Stancheva
the Telerik team
Due to the Sandbox environment limitations, it is very hard to use in the solutions any dynamic controls that rely on external resources. This is why the RadUpload control can't work in a Sandbox solution as its handler should derive from the RadUploadHandler class.
My previous suggestions are the only workaround that we are aware of.
Regards,
Tina Stancheva
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>