taskqueue advice, mp user api, mypage question

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.
3/28/2012 4:39:37 PM
Gravatar
Total Posts 4

taskqueue advice, mp user api, mypage question

Could use some pointers here, not sure I'm working in the right direction.

1. I have a taskqueue task I wrote which does an import from a remote site every 15m, but global.asax is part of the mp source code. Should I add the task when classes are loaded / the app pool is recycled or could I run into issues doing so? The task only uses the taskqueue interface, database access is seperate from MP.

2. I have some webservices to use with a desktop application, up till now I'm using loginname for the portal and secret question as security validation, as wel as comparing the know forum login ip's with the current context. If people store their user/pwd ( cookie ) I can use webuser though. I just don't like using secretquestion, I would rather use the password, but what mp api do I need to call to validate the password against the hashed db content? At least, I think I need to do this as I'm using the sitestatistics module and I can't just try to log people in ( don't want to show them as logged in when they are only connecting to a webservice ). Any advice?

3 Is it possible to use the 'mypage' feature so I can add personalized pages for members without allowing them to remove/add components or do I need to customise the code for that?

3/29/2012 7:35:14 AM
Gravatar
Total Posts 18439

Re: taskqueue advice, mp user api, mypage question

Hi,

1. If you are running on your own servers I would implement a Windows Service to do tasks like that. However to answer your question, though you should not modify global.asax.cs so you can't add things in Application_Start, you can implement a custtom HttpModule and plug it in via web.con fig in the <modules> section, a skeletal example of the HttpModule is like this:

using System;
using System.Web;
using mojoPortal.Business;
using mojoPortal.Web;

namespace yournamespace
{
public class YourHttpModule : IHttpModule
{
private static bool HasAppStarted = false;
private readonly static object _syncObject = new object();

public void Init(HttpApplication application)
{
//this is the closest thing we have to Application_Start

if (!HasAppStarted)
{
lock (_syncObject)
{
if (!HasAppStarted)
{
StartTask();
HasAppStarted = true;
}
}
}

}

private void StartTask()
{
//Code to queue your task goes here
WebTaskManager.StartOrResumeTasks();

}

public void Dispose() { }
}
}

Keep in mind that tasks run on a background thread and from there you have no access to things like HttpContext so any code you call that uses it will fail.

2. In Manage Users page you can set Include In Member List to false and the users will not show up in site statistics, but other than that there is no way if they are authenticated. There is a build in ASP.NET Authentication Service that accesses the Membership Provider, it is meant for use in silverlight or desktop apps. In mojoPortal the service lives at /Services/AuthenticationService.svc. There are some things commented out in Web.config related to this service but I don't have any documentation for you about using it so I would refer you to the Microsoft documentation.

3. I don't remember for sure but ASP.NET webparts are designed for people to be able to personalize the page so the answer might be no, you'll have to experiment yourself, the MyPage feature has been removed and deprecated and I've lost any personal interest in it.

In the future please one question per thread to help keep things easy to find if somone else has the same questions.

Hope that helps,

Joe

3/29/2012 9:23:26 AM
Gravatar
Total Posts 4

Re: taskqueue advice, mp user api, mypage question

Thank you on all three accounts Lachen I'll seperate questions next time as well.

1. For the httpmodule, I was already looking into that as I want to measure how long certain request take ( and that's only possible through httpmodule or global.asax. If using the httpmodule for starting my taskqueue class, can I also use it for selective query url's for the main site?

2. If I added a shadow user for every registration I could use that for authentication of webapp queries as I can set the shadow account to hidden, and validate a username/password through mojoPortal.Web.mojoMembershipprovider.validateUser(name,pwd)? That would be easier then adding a second site to hold a member collection and not much else ( unless I could/should combine it with 1. )

3. Gotcha, was hoping for a quick way to make personalized statistics pages ( my site is meant for collecting statistics from Folding@Home clients, and providing both overall as personal overview options if one is a member ). I can make custom modules for this though and use the construction from 1 and 2 to be able to identify users and their personal submitted statistics.

 Edit: I would buy you a beer if I had a paypall account ( but I'm going to set one up, and I'll mark you down for one ).

 

 

 

 

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