Best Way to get Page and Module in custom IHttpHandler

This forum is only for questions or discussions about working with the mojoPortal source code in Visual Studio, obtaining the source code from the repository, developing custom features, etc. If your question is not along these lines this is not the right forum. Please try to post your question in the appropriate forum.

Please do not post questions about design, CSS, or skinning here. Use the Help With Skins Forum for those questions.

This forum is for discussing mojoPortal development

This forum is only for questions or discussions about working with the mojoPortal source code in Visual Studio, obtaining the source code from the repository, developing custom features, etc. If your question is not along these lines this is not the right forum. Please try to post your question in the appropriate forum.

You can monitor commits to the repository from this page. We also recommend developers to subscribe to email notifications in the developer forum as occasionally important things are announced.

Before posting questions here you might want to review the developer documentation.

Do not post questions about design, CSS, or skinning here. Use the Help With Skins Forum for those questions.
This thread is closed to new posts. You must sign in to post in the forums.
2/4/2011 9:32:03 AM
Gravatar
Total Posts 76

Best Way to get Page and Module in custom IHttpHandler

Guys,

I am building a custom Silverlight Multi-file Uploader, I am using a HttpHandler to take the chunks.

 

I would like to apply the user viewing permissions to the incoming chunks... 

Like if the user is allowed to see the page and the module, the chunks will be accepted...

I am passing the pageid and moduleid in the posted data params...

what is the best way to load up the page and module outside of making the handler a (mojobasepage).

I also plan on needing to make the page and module requests cached so when a big file is uploaded there is not a huge amount of DB traffic

 

Any recommendations?

 

thx

2/4/2011 12:33:23 PM
Gravatar
Total Posts 18439

Re: Best Way to get Page and Module in custom IHttpHandler

As long as the url has pageid in it, you can get it like this:

using mojoPortal.Business;
using mojoPortal.Business.WebHelpers;

PageSettings currentPage = CacheHelper.GetCurrentPage();

from there you can check page permissions and you can loop through currentPage.Modules find the one with the moduleid and check permissions on it.

Hope it helps,

Joe

2/9/2011 9:41:32 AM
Gravatar
Total Posts 76

Re: Best Way to get Page and Module in custom IHttpHandler

Thanks Joe,

I had found this code, and can modify to fit my needs. 

Let me detail where i am more concerned...

This FileUpload is designed to handle multiple files and its use case is for large files ( 2 GB + )

the mechanism is to "chunk" the bytes, so there would be alot of action on httphandler in bursts (http://www.codeplex.com/SLFileUpload/)

I am worried that i will be hitting the DB way too often in the method in CacheHelper.cs : private static PageSettings LoadCurrentPage()

I don't see any "caching" in the method,

what would be the best way to cache the loaded page? im guessing with the right cache dependency( sitemapcachedependecy.config? not sure on this) and the module cache-dependancy file ( i use this for alot of my custom module caching )

thoughts?

 

Thanks Warner~

2/9/2011 9:51:22 AM
Gravatar
Total Posts 18439

Re: Best Way to get Page and Module in custom IHttpHandler

Hi Warner,

You are correct that CacheHelper.GetCurrentPage is not really caching in the classic sense of the word, it "caches" into the HttpContext.Items collection so it is retrieved only once in the lifetime of a request. If you are saying this chunking of uploads involves multiple requests then you should probably implement your own caching of the currentPage object after you get it from CacheHelper. You would need to implement your own dependency file to clear the cache, or you could potentially "cache" it in a session variable and then clear the variable after the upload completes.

Hope it helps,

Joe

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