New upload control - how hard would it be to "plug it in"?

This is a forum to suggest new features for mojoPortal. 

This thread is closed to new posts. You must sign in to post in the forums.
9/20/2011 7:03:25 AM
Gravatar
Total Posts 18439

Re: New upload control - how hard would it be to "plug it in"?

Hi Allan,

I'm going to download your control today and take a look at it.

There is one idea I'd like to put forth in hopes you might like to tackle it. I've done a lot of work lately in mojoPortal for web farm support and one of the things I implemented was a file system abstraction layer and I also implemented a working file system provider for Windows Azure Blob storage and one of the issues I ran into is that my current solution involves uploading to the web node and then from there the file is uploaded to blob storage. It works ok but this 2 hop process takes longer especially for larger files. I think a better solution is to upload directly from the client machine to Azure Blob storage, which as I understand it can be done using a Shared Access Signature which provides a temporary ticket to allow the upload. But since this is client side stuff it would require implementing something directly in the upload control where the access signature would be set server side but then the upload would go directly to blob storage instead of first to the web node. So far I've only seen example implementations that use Silverlight, I'm not even sure if it can be done without using something like that, but it would be really great if it is possible to do it without requiring the silverlight plugin.

Anyway, just food for thought.

Best,

Joe

9/20/2011 7:18:12 AM
Gravatar
Total Posts 18439

Re: New upload control - how hard would it be to "plug it in"?

Hi Allan,

I just downloaded and tried it out, I built the solution as Release - Session and launched the Default.aspx of the web demo project in the browser and I got a security error:

Security Exception
Description: The application attempted to perform an operation not allowed by the security policy.  To grant this application the required permission please contact your system administrator or change the application's trust level in the configuration file.

Exception Details: System.Security.SecurityException: Request for the permission of type 'System.Web.AspNetHostingPermission, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.
 

and I'm not even running it in medium trust. So I get the sense it won't run in medium trust?

Best,

Joe

9/20/2011 4:07:48 PM
Gravatar
Total Posts 6

Re: New upload control - how hard would it be to "plug it in"?

Hi Joe.

Very odd - the web.config has trust level set to "High", but I have tried setting it to "Medium" and it still works.

A quick google said something about network/file permissions - are you using a local/remote IIS or the one build into Visual Studio? Or something about file permissions where the solution is?

It works with the VS build in hosting-thingy (forgot its name) and I have it running on IIS 7.0 in full trust at work and at a hosting provider with my own website (which says it uses medium trust, but is closer to High trust.) But I must admit I have not tried it using the local IIS (my machine is a bit underpowered for that), so maybe it requires some extra settings for that? I just tested the unzipped solution with VS on my work computer, and it runs fine there too (without using IIS).

!?

Edit: Most likely you put the unzipped solution on a network or external drive. Putting it on a local drive should solve it?

 

Regarding Azure, it is an interesting new platform which I unfortunately have not yet had a reason to study - so thank you for giving me a good reason to study it! :-)

But is Azure not always based on SQL Server? So wouldn't the version of my upload control which stores uploaded files in the database instead of the file system be perfect for that?

Remember, my upload control does not actually try to save any files to any public part of your website - it just holds them and passes them to your server code (in a partial postback event), so you can decide what you want to do with them. And you might as well store them a totally different place than the database or the file system, if you have such a place available. This of course also give you "2 hops", but in each their own postback.

But I could take my session-based version and see how it could store the temporary files in the Azure blob storage instead of the file system - if the normal website structure is available so that my two upload handlers can receive the files?

(Honestly, I have no idea how a website without a file system is structured... And I also got two paid projects I need to finish now, so it will probably take a few weeks before I get back to studying Azure. Sorry.)

Edit: JavaScript in older browsers (like Internet Explorer) can postback to special URLs, but the file content of the postback cannot be manipulated by JavaScript, so it requires a special upload handler to extract the file upload (which can be attached to the postback in two different ways) and store it. For security reasons I would also recommend having an upload handler to accept or reject uploads, as even though Silverlight or Flash could do what you want client side, their actions can be seen and misused by a hacker if there is the slightest hole in the security rules (for example you should not allow reading an uploaded file before your code have verified it is safe, and have removed upload rights so it cannot be replaced).

 

Bests

Allan K.

 

10/6/2011 2:20:06 PM
Gravatar
Total Posts 18439

Re: New upload control - how hard would it be to "plug it in"?

Hi Allan,

Sorry I haven't got back to you sooner. I did unzip your control on a network share so that is probably the problem, I just haven't had a chance to try it again.

I have created a document with an overview of Windows Azure, SqlAzure is the database part of Azure but there are many other parts. The Azure Blob Storage is what would be used for file uploads. I've implemented a file system layer for Azure Blob Storage but it runs on the web role, so the file gets uploaded to the web role and then from there up to Azure Blob storage, but there are ways to do it by generating temporary tickets that allow directly uploading from the client to the blob storage using a REST api. So I think it would involve generating the ticket server side and then rendering into javascript on the page. I "think" that what the Silverlight uploaders do is somehow upload it in chunks which makes handling larger files easier, but I'm not all that up to speed on it. Posting the file to the rest api from javascript may work well enough for most files.

When I get a chance I'll give your control another try and make sure to unzip it on a local drive.

Best,

Joe

You must sign in to post in the forums. This thread is closed to new posts.